sharing WIP

This commit is contained in:
zadam 2021-12-21 16:12:59 +01:00
parent 8b56fb10fd
commit e7faebfac3
10 changed files with 11396 additions and 132 deletions

View file

@ -0,0 +1 @@
UPDATE branches SET branchId = 'hidden' where parentNoteId = 'root' AND noteId = 'hidden';

11452
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -78,7 +78,7 @@
"tmp": "^0.2.1",
"turndown": "7.1.1",
"unescape": "1.0.1",
"ws": "8.3.0",
"ws": "8.4.0",
"yauzl": "2.10.0"
},
"devDependencies": {

View file

@ -75,7 +75,9 @@ async function resolveNotePathToSegments(notePath, hoistedNoteId = 'root', logEr
if (logErrors) {
const parent = froca.getNoteFromCache(parentNoteId);
console.debug(utils.now(), `Did not find parent ${parentNoteId} (${parent ? parent.title : 'n/a'}) for child ${childNoteId} (${child.title}), available parents: ${parents.map(p => `${p.noteId} (${p.title})`)}. You can ignore this message as it is mostly harmless.`);
console.debug(utils.now(), `Did not find parent ${parentNoteId} (${parent ? parent.title : 'n/a'})
for child ${childNoteId} (${child.title}), available parents: ${parents.map(p => `${p.noteId} (${p.title})`)}.
You can ignore this message as it is mostly harmless.`);
}
const someNotePath = getSomeNotePath(child, hoistedNoteId);
@ -83,6 +85,10 @@ async function resolveNotePathToSegments(notePath, hoistedNoteId = 'root', logEr
if (someNotePath) { // in case it's root the path may be empty
const pathToRoot = someNotePath.split("/").reverse().slice(1);
if (!pathToRoot.includes("root")) {
pathToRoot.push('root');
}
for (const noteId of pathToRoot) {
effectivePathSegments.push(noteId);
}

View file

@ -1,5 +1,4 @@
import SwitchWidget from "./switch.js";
import froca from "../services/froca.js";
import branchService from "../services/branches.js";
import server from "../services/server.js";
import utils from "../services/utils.js";
@ -39,7 +38,7 @@ export default class SharedSwitchWidget extends SwitchWidget {
}
}
await server.remove(`branches/${shareBranch.branchId}`);
await server.remove(`branches/${shareBranch.branchId}?taskId=no-progress-reporting`);
}
async refreshWithNote(note) {

View file

@ -1,3 +1,7 @@
body {
font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif;
}
#layout {
max-width: 1200px;
margin: 0 auto;
@ -32,7 +36,7 @@
#title {
margin: 0;
padding: 10px 20px 0 20px;
padding: 20px 20px 0 20px;
}
#content {
@ -48,40 +52,54 @@ pre {
word-wrap: anywhere;
}
#menuLink {
#menuButton {
display: none;
position: fixed;
display: block;
top: 0;
left: 0;
top: 8px;
left: 5px;
width: 1.4em;
background: #000;
background: rgba(0,0,0,0.7);
border-radius: 5px;
border: 1px solid #aaa;
font-size: 2rem;
z-index: 10;
height: auto;
color: white;
border: none;
color: black;
cursor: pointer;
}
#menuButton::after {
position: relative;
top: -2px;
left: 1px;
}
@media (max-width: 48em) {
#layout.active #menu {
display: block;
margin-top: 40px;
}
#menuButton {
display: block;
}
#layout.active #main {
display: none;
}
#layout.active #menuLink::after {
#title {
padding-left: 60px;
}
#layout.active #menuButton::after {
content: "«";
}
#menuButton::after {
content: "»";
}
#menu {
display: none;
}
#menuLink::after {
content: "»";
}
}

View file

@ -4,7 +4,7 @@ const build = require('./build');
const packageJson = require('../../package');
const {TRILIUM_DATA_DIR} = require('./data_dir');
const APP_DB_VERSION = 187;
const APP_DB_VERSION = 188;
const SYNC_VERSION = 23;
const CLIPPER_PROTOCOL_VERSION = "1.0";

View file

@ -94,7 +94,7 @@ async function createInitialDatabase(username, password, theme) {
log.info("Importing demo content ...");
const dummyTaskContext = new TaskContext("initial-demo-import", 'import', false);
const dummyTaskContext = new TaskContext("no-progress-reporting", 'import', false);
const zipImportService = require("./import/zip");
await zipImportService.importZip(dummyTaskContext, demoFile, rootNote);

View file

@ -34,7 +34,7 @@ class TaskContext {
increaseProgressCount() {
this.progressCount++;
if (Date.now() - this.lastSentCountTs >= 300 && this.taskId !== 'initial-demo-import') {
if (Date.now() - this.lastSentCountTs >= 300 && this.taskId !== 'no-progress-reporting') {
this.lastSentCountTs = Date.now();
ws.sendMessageToAllClients({

View file

@ -12,11 +12,13 @@
</head>
<body>
<div id="layout">
<button id="menuLink"></button>
<% if (subRoot.hasChildren()) { %>
<button id="menuButton"></button>
<div id="menu">
<%- include('share-tree-item', {note: subRoot, activeNote: note}) %>
</div>
<% } %>
<div id="main">
<h1 id="title"><%= note.title %></h1>
@ -36,7 +38,7 @@
return {
layout: document.getElementById('layout'),
menu: document.getElementById('menu'),
menuLink: document.getElementById('menuLink')
menuButton: document.getElementById('menuButton')
};
}
@ -65,13 +67,13 @@
toggleClass(elements.layout, active);
toggleClass(elements.menu, active);
toggleClass(elements.menuLink, active);
toggleClass(elements.menuButton, active);
}
function handleEvent(e) {
var elements = getElements();
if (e.target.id === elements.menuLink.id) {
if (e.target.id === elements.menuButton.id) {
toggleAll();
e.preventDefault();
} else if (elements.menu.className.indexOf('active') !== -1) {