mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 08:46:43 +01:00
Compare commits
95 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7c59700a5 | ||
|
|
f1a7fce277 | ||
|
|
1a182d1b58 | ||
|
|
8bd52f349a | ||
|
|
68faa47c6f | ||
|
|
2f2a14d4b8 | ||
|
|
a2a53deb94 | ||
|
|
d50e072ea4 | ||
|
|
904eb25f64 | ||
|
|
205081c804 | ||
|
|
c4d5060a0b | ||
|
|
5bba18191f | ||
|
|
5e3538669d | ||
|
|
23c449ca0c | ||
|
|
b7344329f4 | ||
|
|
e04845335b | ||
|
|
86a330c8c3 | ||
|
|
f82e99b5ed | ||
|
|
bdf42749f3 | ||
|
|
7ccbf45569 | ||
|
|
c0b30e603a | ||
|
|
d3c957768f | ||
|
|
ed9ecf2a57 | ||
|
|
22d48b0586 | ||
|
|
edc23940d0 | ||
|
|
c72ea2ed60 | ||
|
|
4570319517 | ||
|
|
69d739400c | ||
|
|
ec7c0f0723 | ||
|
|
3de124748d | ||
|
|
41d47c5d33 | ||
|
|
132360b46b | ||
|
|
f0496cb42c | ||
|
|
1522297700 | ||
|
|
2a5ab3a5e1 | ||
|
|
358fd13c8d | ||
|
|
2305ad7405 | ||
|
|
78f5b7b288 | ||
|
|
1903c59163 | ||
|
|
b16c2d19b6 | ||
|
|
00bb1236ce | ||
|
|
82bbf4173b | ||
|
|
9f4ca279aa | ||
|
|
b890859025 | ||
|
|
56e4f4f5ac | ||
|
|
157bd3816d | ||
|
|
21588829c7 | ||
|
|
9689029c4b | ||
|
|
992d174b23 | ||
|
|
8886e95847 | ||
|
|
6d5762fac8 | ||
|
|
e9ab044e46 | ||
|
|
fda219d070 | ||
|
|
2be1aca2f3 | ||
|
|
1b318d6a30 | ||
|
|
22c4859d42 | ||
|
|
80a6361cf1 | ||
|
|
8439effeeb | ||
|
|
fafab95a07 | ||
|
|
24c8e8fc2b | ||
|
|
1923bf7dda | ||
|
|
2ee94a3a69 | ||
|
|
2fb3a3eff9 | ||
|
|
bcbbf4dc3e | ||
|
|
7dc793920f | ||
|
|
0b43eceb2d | ||
|
|
85f736139b | ||
|
|
98a6670cb4 | ||
|
|
c9432990b7 | ||
|
|
9ad521822d | ||
|
|
824fb08511 | ||
|
|
cc4c15daf0 | ||
|
|
7718778013 | ||
|
|
a25260353d | ||
|
|
c1e8a4b384 | ||
|
|
3f2229d9e1 | ||
|
|
8561227622 | ||
|
|
8859e2ac40 | ||
|
|
7423b2f4fd | ||
|
|
d23e9f1bc4 | ||
|
|
516277a478 | ||
|
|
cbc7710d81 | ||
|
|
ea71e96f72 | ||
|
|
59d1cb1833 | ||
|
|
7c54ba63ce | ||
|
|
5892b5b851 | ||
|
|
02eb737b9d | ||
|
|
144e75da9e | ||
|
|
8d14a0d687 | ||
|
|
dec2c218f7 | ||
|
|
dd147a7209 | ||
|
|
c3fabcb666 | ||
|
|
35e825b376 | ||
|
|
334a38c493 | ||
|
|
8ec01c73cd |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@ yarn-error.log
|
||||
config.ini
|
||||
cert.key
|
||||
cert.crt
|
||||
server-package.json
|
||||
15
.gitpod.dockerfile
Normal file
15
.gitpod.dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
FROM gitpod/workspace-full
|
||||
|
||||
RUN sudo apt-get update \
|
||||
&& sudo apt-get install -yq --no-install-recommends \
|
||||
libpng16-16 \
|
||||
libpng-dev \
|
||||
pkg-config \
|
||||
autoconf \
|
||||
libtool \
|
||||
build-essential \
|
||||
nasm \
|
||||
libx11-dev \
|
||||
libxkbfile-dev \
|
||||
&& sudo rm -rf /var/lib/apt/lists/*
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
image:
|
||||
file: .gitpod.dockerfile
|
||||
|
||||
tasks:
|
||||
- before: nvm install 10 && nvm use 10
|
||||
init: npm install
|
||||
command: npm run start
|
||||
command: npm run start-server
|
||||
|
||||
ports:
|
||||
- port: 8080
|
||||
onOpen: open-preview
|
||||
@@ -57,7 +57,6 @@
|
||||
<index id="24" parent="6" name="sqlite_autoindex_api_tokens_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>apiTokenId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="25" parent="6">
|
||||
@@ -126,25 +125,20 @@
|
||||
<index id="37" parent="7" name="sqlite_autoindex_attributes_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>attributeId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<index id="38" parent="7" name="IDX_attributes_noteId_index">
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="39" parent="7" name="IDX_attributes_name_value">
|
||||
<ColNames>name
|
||||
value</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="40" parent="7" name="IDX_attributes_name_index">
|
||||
<ColNames>name</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="41" parent="7" name="IDX_attributes_value_index">
|
||||
<ColNames>value</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<key id="42" parent="7">
|
||||
<ColNames>attributeId</ColNames>
|
||||
@@ -204,21 +198,17 @@ value</ColNames>
|
||||
<index id="53" parent="8" name="sqlite_autoindex_branches_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>branchId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<index id="54" parent="8" name="IDX_branches_noteId_parentNoteId">
|
||||
<ColNames>noteId
|
||||
parentNoteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="55" parent="8" name="IDX_branches_noteId">
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="56" parent="8" name="IDX_branches_parentNoteId">
|
||||
<ColNames>parentNoteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<key id="57" parent="8">
|
||||
<ColNames>branchId</ColNames>
|
||||
@@ -246,7 +236,6 @@ parentNoteId</ColNames>
|
||||
<index id="62" parent="9" name="sqlite_autoindex_event_log_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>eventId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="63" parent="9">
|
||||
@@ -278,7 +267,6 @@ parentNoteId</ColNames>
|
||||
<index id="68" parent="10" name="sqlite_autoindex_note_contents_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="69" parent="10">
|
||||
@@ -351,20 +339,16 @@ parentNoteId</ColNames>
|
||||
<index id="82" parent="11" name="sqlite_autoindex_note_revisions_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>noteRevisionId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<index id="83" parent="11" name="IDX_note_revisions_noteId">
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="84" parent="11" name="IDX_note_revisions_dateModifiedFrom">
|
||||
<ColNames>utcDateModifiedFrom</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<index id="85" parent="11" name="IDX_note_revisions_dateModifiedTo">
|
||||
<ColNames>utcDateModifiedTo</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<key id="86" parent="11">
|
||||
<ColNames>noteRevisionId</ColNames>
|
||||
@@ -435,7 +419,6 @@ parentNoteId</ColNames>
|
||||
<index id="98" parent="12" name="sqlite_autoindex_notes_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="99" parent="12">
|
||||
@@ -477,7 +460,6 @@ parentNoteId</ColNames>
|
||||
<index id="106" parent="13" name="sqlite_autoindex_options_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>name</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="107" parent="13">
|
||||
@@ -513,7 +495,6 @@ parentNoteId</ColNames>
|
||||
<index id="113" parent="14" name="sqlite_autoindex_recent_notes_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>noteId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="114" parent="14">
|
||||
@@ -534,7 +515,6 @@ parentNoteId</ColNames>
|
||||
<index id="117" parent="15" name="sqlite_autoindex_source_ids_1">
|
||||
<NameSurrogate>1</NameSurrogate>
|
||||
<ColNames>sourceId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<key id="118" parent="15">
|
||||
@@ -597,12 +577,10 @@ parentNoteId</ColNames>
|
||||
<index id="131" parent="18" name="IDX_sync_entityName_entityId">
|
||||
<ColNames>entityName
|
||||
entityId</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
<Unique>1</Unique>
|
||||
</index>
|
||||
<index id="132" parent="18" name="IDX_sync_utcSyncDate">
|
||||
<ColNames>utcSyncDate</ColNames>
|
||||
<ColumnCollations></ColumnCollations>
|
||||
</index>
|
||||
<key id="133" parent="18">
|
||||
<ColNames>id</ColNames>
|
||||
|
||||
6
.idea/jsLibraryMappings.xml
generated
Normal file
6
.idea/jsLibraryMappings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptLibraryMappings">
|
||||
<file url="PROJECT" libraries="{@types/jquery}" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,11 +1,9 @@
|
||||
FROM node:12.10.0-alpine
|
||||
FROM node:12.13.0-alpine
|
||||
|
||||
# Create app directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Copy both package.json and package-lock.json
|
||||
# where available (npm@5+)
|
||||
COPY package.json package-lock.json ./
|
||||
COPY server-package.json package.json
|
||||
|
||||
# Install app dependencies
|
||||
RUN set -x \
|
||||
|
||||
11
README.md
11
README.md
@@ -46,5 +46,12 @@ Use a browser based dev environment
|
||||
Or clone locally and run
|
||||
```
|
||||
npm install
|
||||
npm run start
|
||||
```
|
||||
npm run start-server
|
||||
```
|
||||
|
||||
## Shoutouts
|
||||
|
||||
* [CKEditor 5](https://github.com/ckeditor/ckeditor5) - best WYSIWYG editor on the market, very interactive and listening team
|
||||
* [FancyTree](https://github.com/mar10/fancytree) - very feature rich tree library without real competition. Trilium Notes would not be the same without it.
|
||||
* [CodeMirror](https://github.com/codemirror/CodeMirror) - code editor with support for huge amount of languages
|
||||
* [jsPlumb](https://github.com/jsplumb/jsplumb) - visual connectivity library without competition. Used in [relation maps](https://github.com/zadam/trilium/wiki/Relation-map) and [link maps](https://github.com/zadam/trilium/wiki/Link-map)
|
||||
@@ -3,6 +3,8 @@
|
||||
VERSION=`jq -r ".version" package.json`
|
||||
SERIES=${VERSION:0:4}-latest
|
||||
|
||||
cat package.json | grep -v electron > server-package.json
|
||||
|
||||
sudo docker build -t zadam/trilium:$VERSION -t zadam/trilium:$SERIES .
|
||||
|
||||
if [[ $VERSION != *"beta"* ]]; then
|
||||
|
||||
@@ -1,20 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
BUILD_DIR=./dist/trilium-linux-x64
|
||||
rm -rf $BUILD_DIR
|
||||
SRC_DIR=./dist/trilium-linux-x64-src
|
||||
|
||||
if [ "$1" != "DONTCOPY" ]
|
||||
then
|
||||
./bin/copy-trilium.sh $SRC_DIR
|
||||
fi
|
||||
|
||||
echo "Copying required linux-x64 binaries"
|
||||
|
||||
rm -r node_modules/sqlite3/lib/binding/*
|
||||
rm -r node_modules/pngquant-bin/vendor/*
|
||||
rm -r $SRC_DIR/node_modules/sqlite3/lib/binding/*
|
||||
rm -r $SRC_DIR/node_modules/pngquant-bin/vendor/*
|
||||
rm -r $SRC_DIR/node_modules/@felixrieseberg/spellchecker/build/Release/*
|
||||
|
||||
cp -r bin/deps/linux-x64/sqlite/* node_modules/sqlite3/lib/binding/
|
||||
cp bin/deps/linux-x64/image/pngquant node_modules/pngquant-bin/vendor/
|
||||
cp -r bin/deps/linux-x64/sqlite/* $SRC_DIR/node_modules/sqlite3/lib/binding/
|
||||
cp bin/deps/linux-x64/image/pngquant $SRC_DIR/node_modules/pngquant-bin/vendor/
|
||||
cp bin/deps/linux-x64/spellchecker/* $SRC_DIR/node_modules/@felixrieseberg/spellchecker/build/Release/
|
||||
|
||||
# rebuild binaries for image operations (pngquant ...)
|
||||
npm rebuild
|
||||
./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=linux --arch=x64 --overwrite
|
||||
|
||||
./node_modules/.bin/electron-packager . --asar --out=dist --executable-name=trilium --platform=linux --arch=x64 --overwrite
|
||||
BUILD_DIR=./dist/trilium-linux-x64
|
||||
rm -rf $BUILD_DIR
|
||||
|
||||
mv "./dist/Trilium Notes-linux-x64" $BUILD_DIR
|
||||
|
||||
@@ -29,3 +35,7 @@ VERSION=`jq -r ".version" package.json`
|
||||
cd dist
|
||||
|
||||
tar cJf trilium-linux-x64-${VERSION}.tar.xz trilium-linux-x64
|
||||
|
||||
cd ..
|
||||
|
||||
bin/build-debian.sh
|
||||
@@ -1,27 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SRC_DIR=./dist/trilium-mac-x64-src
|
||||
|
||||
if [ "$1" != "DONTCOPY" ]
|
||||
then
|
||||
./bin/copy-trilium.sh $SRC_DIR
|
||||
fi
|
||||
|
||||
echo "Copying required mac binaries"
|
||||
|
||||
rm -r $SRC_DIR/node_modules/sqlite3/lib/binding/*
|
||||
rm -r $SRC_DIR/node_modules/mozjpeg/vendor/*
|
||||
rm -r $SRC_DIR/node_modules/pngquant-bin/vendor/*
|
||||
rm -r $SRC_DIR/node_modules/giflossy/vendor/*
|
||||
rm -r $SRC_DIR/node_modules/@felixrieseberg/spellchecker/build/Release/*
|
||||
rm -r $SRC_DIR/node_modules/keyboard-layout/build/Release/*
|
||||
|
||||
cp -r bin/deps/mac-x64/sqlite/* $SRC_DIR/node_modules/sqlite3/lib/binding/
|
||||
cp bin/deps/mac-x64/image/cjpeg $SRC_DIR/node_modules/mozjpeg/vendor/
|
||||
cp bin/deps/mac-x64/image/pngquant $SRC_DIR/node_modules/pngquant-bin/vendor/
|
||||
cp bin/deps/mac-x64/image/gifsicle $SRC_DIR/node_modules/giflossy/vendor/
|
||||
cp bin/deps/mac-x64/spellchecker/* $SRC_DIR/node_modules/@felixrieseberg/spellchecker/build/Release/
|
||||
cp bin/deps/mac-x64/keyboard-layout-manager.node $SRC_DIR/node_modules/keyboard-layout/build/Release/
|
||||
|
||||
./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=darwin --arch=x64 --overwrite --icon=images/app-icons/mac/icon.icns
|
||||
|
||||
BUILD_DIR=./dist/trilium-mac-x64
|
||||
rm -rf $BUILD_DIR
|
||||
|
||||
echo "Copying required mac binaries"
|
||||
|
||||
rm -r node_modules/sqlite3/lib/binding/*
|
||||
rm -r node_modules/mozjpeg/vendor/*
|
||||
rm -r node_modules/pngquant-bin/vendor/*
|
||||
rm -r node_modules/giflossy/vendor/*
|
||||
|
||||
cp -r bin/deps/mac-x64/sqlite/* node_modules/sqlite3/lib/binding/
|
||||
cp bin/deps/mac-x64/image/cjpeg node_modules/mozjpeg/vendor/
|
||||
cp bin/deps/mac-x64/image/pngquant node_modules/pngquant-bin/vendor/
|
||||
cp bin/deps/mac-x64/image/gifsicle node_modules/giflossy/vendor/
|
||||
|
||||
./node_modules/.bin/electron-packager . --asar --out=dist --executable-name=trilium --platform=darwin --arch=x64 --overwrite --icon=images/app-icons/mac/icon.icns
|
||||
|
||||
# Mac build has by default useless directory level
|
||||
mv "./dist/Trilium Notes-darwin-x64" $BUILD_DIR
|
||||
|
||||
./bin/reset-local.sh
|
||||
|
||||
echo "Zipping mac x64 electron distribution..."
|
||||
|
||||
VERSION=`jq -r ".version" package.json`
|
||||
|
||||
@@ -1,40 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PKG_DIR=dist/trilium-linux-x64-server
|
||||
NODE_VERSION=12.10.0
|
||||
NODE_VERSION=12.13.0
|
||||
|
||||
rm -r $PKG_DIR
|
||||
mkdir $PKG_DIR
|
||||
cd $PKG_DIR
|
||||
if [ "$1" != "DONTCOPY" ]
|
||||
then
|
||||
./bin/copy-trilium.sh $PKG_DIR
|
||||
fi
|
||||
|
||||
cd dist
|
||||
wget https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz
|
||||
tar xvfJ node-v${NODE_VERSION}-linux-x64.tar.xz
|
||||
rm node-v${NODE_VERSION}-linux-x64.tar.xz
|
||||
|
||||
mv node-v${NODE_VERSION}-linux-x64 node
|
||||
|
||||
cp -r ../../node_modules/ ./
|
||||
cp -r ../../images/ ./
|
||||
cp -r ../../libraries/ ./
|
||||
cp -r ../../src/ ./
|
||||
cp -r ../../db/ ./
|
||||
cp -r ../../package.json ./
|
||||
cp -r ../../package-lock.json ./
|
||||
cp -r ../../README.md ./
|
||||
cp -r ../../LICENSE ./
|
||||
cp -r ../../config-sample.ini ./
|
||||
|
||||
rm -r ./node_modules/electron*
|
||||
|
||||
rm -r ./node_modules/sqlite3/lib/binding/*
|
||||
|
||||
cp -r ../../bin/deps/linux-x64/sqlite/node* ./node_modules/sqlite3/lib/binding/
|
||||
|
||||
printf "#!/bin/sh\n./node/bin/node src/www" > trilium.sh
|
||||
chmod 755 trilium.sh
|
||||
|
||||
cd ..
|
||||
|
||||
VERSION=`jq -r ".version" ../package.json`
|
||||
mv dist/node-v${NODE_VERSION}-linux-x64 $PKG_DIR/node
|
||||
|
||||
rm -r $PKG_DIR/node_modules/electron*
|
||||
|
||||
rm -r $PKG_DIR/node_modules/sqlite3/lib/binding/*
|
||||
|
||||
cp -r ./bin/deps/linux-x64/sqlite/node* $PKG_DIR/node_modules/sqlite3/lib/binding/
|
||||
|
||||
printf "#!/bin/sh\n./node/bin/node src/www" > $PKG_DIR/trilium.sh
|
||||
chmod 755 $PKG_DIR/trilium.sh
|
||||
|
||||
VERSION=`jq -r ".version" package.json`
|
||||
|
||||
cd dist
|
||||
|
||||
tar cJf trilium-linux-x64-server-${VERSION}.tar.xz trilium-linux-x64-server
|
||||
|
||||
@@ -1,29 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
BUILD_DIR=./dist/trilium-windows-x64
|
||||
rm -rf $BUILD_DIR
|
||||
SRC_DIR=./dist/trilium-windows-x64-src
|
||||
|
||||
if [ "$1" != "DONTCOPY" ]
|
||||
then
|
||||
./bin/copy-trilium.sh $SRC_DIR
|
||||
fi
|
||||
|
||||
echo "Copying required windows binaries"
|
||||
|
||||
rm -r node_modules/sqlite3/lib/binding/*
|
||||
rm -r node_modules/mozjpeg/vendor/*
|
||||
rm -r node_modules/pngquant-bin/vendor/*
|
||||
rm -r node_modules/giflossy/vendor/*
|
||||
rm -r $SRC_DIR/node_modules/sqlite3/lib/binding/*
|
||||
rm -r $SRC_DIR/node_modules/mozjpeg/vendor/*
|
||||
rm -r $SRC_DIR/node_modules/pngquant-bin/vendor/*
|
||||
rm -r $SRC_DIR/node_modules/giflossy/vendor/*
|
||||
rm -r $SRC_DIR/node_modules/@felixrieseberg/spellchecker/build/Release/*
|
||||
rm -r $SRC_DIR/node_modules/keyboard-layout/build/Release/*
|
||||
rm -r $SRC_DIR/node_modules/cld/build/Release/*
|
||||
|
||||
cp -r bin/deps/win-x64/sqlite/* node_modules/sqlite3/lib/binding/
|
||||
cp bin/deps/win-x64/image/cjpeg.exe node_modules/mozjpeg/vendor/
|
||||
cp bin/deps/win-x64/image/pngquant.exe node_modules/pngquant-bin/vendor/
|
||||
cp bin/deps/win-x64/image/gifsicle.exe node_modules/giflossy/vendor/
|
||||
cp -r bin/deps/win-x64/sqlite/* $SRC_DIR/node_modules/sqlite3/lib/binding/
|
||||
cp bin/deps/win-x64/image/cjpeg.exe $SRC_DIR/node_modules/mozjpeg/vendor/
|
||||
cp bin/deps/win-x64/image/pngquant.exe $SRC_DIR/node_modules/pngquant-bin/vendor/
|
||||
cp bin/deps/win-x64/image/gifsicle.exe $SRC_DIR/node_modules/giflossy/vendor/
|
||||
cp bin/deps/win-x64/spellchecker/* $SRC_DIR/node_modules/@felixrieseberg/spellchecker/build/Release/
|
||||
cp bin/deps/win-x64/keyboard-layout-manager.node $SRC_DIR/node_modules/keyboard-layout/build/Release/
|
||||
|
||||
./node_modules/.bin/electron-packager . --asar --out=dist --executable-name=trilium --platform=win32 --arch=x64 --overwrite --icon=images/app-icons/win/icon.ico
|
||||
./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=win32 --arch=x64 --overwrite --icon=images/app-icons/win/icon.ico
|
||||
|
||||
BUILD_DIR=./dist/trilium-windows-x64
|
||||
rm -rf $BUILD_DIR
|
||||
|
||||
mv "./dist/Trilium Notes-win32-x64" $BUILD_DIR
|
||||
|
||||
# removing software WebGL binaries because they are pretty huge and not necessary
|
||||
rm -r $BUILD_DIR/swiftshader
|
||||
|
||||
./bin/reset-local.sh
|
||||
|
||||
echo "Zipping windows x64 electron distribution..."
|
||||
VERSION=`jq -r ".version" package.json`
|
||||
|
||||
|
||||
26
bin/build.sh
26
bin/build.sh
@@ -1,21 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
rm -r node_modules
|
||||
|
||||
npm install
|
||||
|
||||
echo "Deleting existing builds"
|
||||
|
||||
rm -r dist/*
|
||||
rm -rf dist/*
|
||||
|
||||
bin/build-win-x64.sh
|
||||
SRC_DIR=dist/trilium-src
|
||||
|
||||
bin/build-mac-x64.sh
|
||||
bin/copy-trilium.sh $SRC_DIR
|
||||
|
||||
# building X64 linux as the last so electron-rebuild will prepare X64 binaries for local development
|
||||
bin/build-linux-x64.sh
|
||||
# we'll just copy the same SRC dir to all the builds so we don't have to do npm install in each separately
|
||||
cp -r $SRC_DIR ./dist/trilium-linux-x64-src
|
||||
cp -r $SRC_DIR ./dist/trilium-linux-x64-server
|
||||
cp -r $SRC_DIR ./dist/trilium-windows-x64-src
|
||||
cp -r $SRC_DIR ./dist/trilium-mac-x64-src
|
||||
|
||||
# this needs to be run after linux build
|
||||
bin/build-debian.sh
|
||||
bin/build-win-x64.sh DONTCOPY
|
||||
|
||||
bin/build-server.sh
|
||||
bin/build-mac-x64.sh DONTCOPY
|
||||
|
||||
bin/build-linux-x64.sh DONTCOPY
|
||||
|
||||
bin/build-server.sh DONTCOPY
|
||||
|
||||
32
bin/copy-trilium.sh
Executable file
32
bin/copy-trilium.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ $# -eq 0 ]] ; then
|
||||
echo "Missing argument of target directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIR=$1
|
||||
|
||||
rm -rf $DIR
|
||||
mkdir $DIR
|
||||
|
||||
echo "Copying Trilium to build directory $DIR"
|
||||
|
||||
cp -r images $DIR/
|
||||
cp -r libraries $DIR/
|
||||
cp -r src $DIR/
|
||||
cp -r db $DIR/
|
||||
cp -r package.json $DIR/
|
||||
cp -r package-lock.json $DIR/
|
||||
cp -r README.md $DIR/
|
||||
cp -r LICENSE $DIR/
|
||||
cp -r config-sample.ini $DIR/
|
||||
cp -r electron.js $DIR/
|
||||
|
||||
# run in subshell (so we return to original dir)
|
||||
(cd $DIR && npm install --only=prod)
|
||||
|
||||
rm -r $DIR/node_modules/cld/deps
|
||||
|
||||
find $DIR/libraries -name "*.map" -type f -delete
|
||||
find $DIR/libraries -name "hunspell.lib" -type f -delete
|
||||
BIN
bin/deps/linux-x64/spellchecker/hunspell.a
Normal file
BIN
bin/deps/linux-x64/spellchecker/hunspell.a
Normal file
Binary file not shown.
BIN
bin/deps/linux-x64/spellchecker/spellchecker.node
Normal file
BIN
bin/deps/linux-x64/spellchecker/spellchecker.node
Normal file
Binary file not shown.
BIN
bin/deps/mac-x64/keyboard-layout-manager.node
Normal file
BIN
bin/deps/mac-x64/keyboard-layout-manager.node
Normal file
Binary file not shown.
BIN
bin/deps/mac-x64/spellchecker/hunspell.a
Normal file
BIN
bin/deps/mac-x64/spellchecker/hunspell.a
Normal file
Binary file not shown.
BIN
bin/deps/mac-x64/spellchecker/spellchecker.node
Normal file
BIN
bin/deps/mac-x64/spellchecker/spellchecker.node
Normal file
Binary file not shown.
BIN
bin/deps/win-x64/keyboard-layout-manager.node
Executable file
BIN
bin/deps/win-x64/keyboard-layout-manager.node
Executable file
Binary file not shown.
BIN
bin/deps/win-x64/spellchecker/hunspell.lib
Executable file
BIN
bin/deps/win-x64/spellchecker/hunspell.lib
Executable file
Binary file not shown.
BIN
bin/deps/win-x64/spellchecker/spellchecker.lib
Executable file
BIN
bin/deps/win-x64/spellchecker/spellchecker.lib
Executable file
Binary file not shown.
BIN
bin/deps/win-x64/spellchecker/spellchecker.node
Executable file
BIN
bin/deps/win-x64/spellchecker/spellchecker.node
Executable file
Binary file not shown.
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
./node_modules/.bin/electron-rebuild --arch=x64
|
||||
BIN
db/demo.tar
BIN
db/demo.tar
Binary file not shown.
5
db/migrations/0146__add_spell_check_options.sql
Normal file
5
db/migrations/0146__add_spell_check_options.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced)
|
||||
VALUES ('spellCheckEnabled', 'true', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0);
|
||||
|
||||
INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced)
|
||||
VALUES ('spellCheckLanguageCode', 'en-US', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0);
|
||||
@@ -0,0 +1,3 @@
|
||||
INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced)
|
||||
SELECT 'hideTabRowForOneTab', 'false', '2019-05-01T18:31:00.874Z', '2019-05-01T18:31:00.874Z', 0
|
||||
WHERE NOT EXISTS(SELECT 1 FROM options WHERE name = 'hideTabRowForOneTab');
|
||||
22
db/migrations/0148__make_isExpanded_not_null.sql
Normal file
22
db/migrations/0148__make_isExpanded_not_null.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
CREATE TABLE IF NOT EXISTS "mig_branches" (
|
||||
`branchId` TEXT NOT NULL,
|
||||
`noteId` TEXT NOT NULL,
|
||||
`parentNoteId` TEXT NOT NULL,
|
||||
`notePosition` INTEGER NOT NULL,
|
||||
`prefix` TEXT,
|
||||
`isExpanded` INTEGER NOT NULL DEFAULT 0,
|
||||
`isDeleted` INTEGER NOT NULL DEFAULT 0,
|
||||
`utcDateModified` TEXT NOT NULL,
|
||||
utcDateCreated TEXT NOT NULL,
|
||||
hash TEXT DEFAULT "" NOT NULL,
|
||||
PRIMARY KEY(`branchId`));
|
||||
|
||||
INSERT INTO mig_branches (branchId, noteId, parentNoteId, notePosition, prefix, isExpanded, isDeleted, utcDateModified, utcDateCreated, hash)
|
||||
SELECT branchId, noteId, parentNoteId, notePosition, prefix, COALESCE(isExpanded, 0), isDeleted, utcDateModified, utcDateCreated, hash FROM branches;
|
||||
|
||||
DROP TABLE branches;
|
||||
ALTER TABLE mig_branches RENAME TO branches;
|
||||
|
||||
CREATE INDEX `IDX_branches_noteId` ON `branches` (`noteId`);
|
||||
CREATE INDEX `IDX_branches_noteId_parentNoteId` ON `branches` (`noteId`,`parentNoteId`);
|
||||
CREATE INDEX IDX_branches_parentNoteId ON branches (parentNoteId);
|
||||
2
db/migrations/0149__space_out_positions.sql
Normal file
2
db/migrations/0149__space_out_positions.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
UPDATE branches SET notePosition = notePosition * 10;
|
||||
UPDATE attributes SET position = position * 10;
|
||||
@@ -29,25 +29,6 @@ CREATE TABLE IF NOT EXISTS "api_tokens"
|
||||
utcDateCreated TEXT NOT NULL,
|
||||
isDeleted INT NOT NULL DEFAULT 0,
|
||||
hash TEXT DEFAULT "" NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "branches" (
|
||||
`branchId` TEXT NOT NULL,
|
||||
`noteId` TEXT NOT NULL,
|
||||
`parentNoteId` TEXT NOT NULL,
|
||||
`notePosition` INTEGER NOT NULL,
|
||||
`prefix` TEXT,
|
||||
`isExpanded` BOOLEAN,
|
||||
`isDeleted` INTEGER NOT NULL DEFAULT 0,
|
||||
`utcDateModified` TEXT NOT NULL,
|
||||
utcDateCreated TEXT NOT NULL,
|
||||
hash TEXT DEFAULT "" NOT NULL,
|
||||
PRIMARY KEY(`branchId`)
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS "event_log" (
|
||||
`eventId` TEXT NOT NULL PRIMARY KEY,
|
||||
`noteId` TEXT,
|
||||
`comment` TEXT,
|
||||
`utcDateCreated` TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS "options"
|
||||
(
|
||||
name TEXT not null PRIMARY KEY,
|
||||
@@ -84,21 +65,6 @@ CREATE TABLE IF NOT EXISTS "notes" (
|
||||
`utcDateModified` TEXT NOT NULL,
|
||||
PRIMARY KEY(`noteId`)
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS "note_contents" (
|
||||
`noteId` TEXT NOT NULL,
|
||||
`content` TEXT NULL DEFAULT NULL,
|
||||
`hash` TEXT DEFAULT "" NOT NULL,
|
||||
`utcDateModified` TEXT NOT NULL,
|
||||
PRIMARY KEY(`noteId`)
|
||||
);
|
||||
CREATE TABLE recent_notes
|
||||
(
|
||||
noteId TEXT not null primary key,
|
||||
notePath TEXT not null,
|
||||
hash TEXT default "" not null,
|
||||
utcDateCreated TEXT not null,
|
||||
isDeleted INT
|
||||
);
|
||||
CREATE UNIQUE INDEX `IDX_sync_entityName_entityId` ON `sync` (
|
||||
`entityName`,
|
||||
`entityId`
|
||||
@@ -115,14 +81,6 @@ CREATE INDEX `IDX_note_revisions_dateModifiedFrom` ON `note_revisions` (
|
||||
CREATE INDEX `IDX_note_revisions_dateModifiedTo` ON `note_revisions` (
|
||||
`utcDateModifiedTo`
|
||||
);
|
||||
CREATE INDEX `IDX_branches_noteId` ON `branches` (
|
||||
`noteId`
|
||||
);
|
||||
CREATE INDEX `IDX_branches_noteId_parentNoteId` ON `branches` (
|
||||
`noteId`,
|
||||
`parentNoteId`
|
||||
);
|
||||
CREATE INDEX IDX_branches_parentNoteId ON branches (parentNoteId);
|
||||
CREATE INDEX IDX_attributes_name_value
|
||||
on attributes (name, value);
|
||||
CREATE INDEX IDX_attributes_name_index
|
||||
@@ -131,3 +89,33 @@ CREATE INDEX IDX_attributes_noteId_index
|
||||
on attributes (noteId);
|
||||
CREATE INDEX IDX_attributes_value_index
|
||||
on attributes (value);
|
||||
CREATE TABLE IF NOT EXISTS "note_contents" (
|
||||
`noteId` TEXT NOT NULL,
|
||||
`content` TEXT NULL DEFAULT NULL,
|
||||
`hash` TEXT DEFAULT "" NOT NULL,
|
||||
`utcDateModified` TEXT NOT NULL,
|
||||
PRIMARY KEY(`noteId`)
|
||||
);
|
||||
CREATE TABLE recent_notes
|
||||
(
|
||||
noteId TEXT not null primary key,
|
||||
notePath TEXT not null,
|
||||
hash TEXT default "" not null,
|
||||
utcDateCreated TEXT not null,
|
||||
isDeleted INT
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS "branches" (
|
||||
`branchId` TEXT NOT NULL,
|
||||
`noteId` TEXT NOT NULL,
|
||||
`parentNoteId` TEXT NOT NULL,
|
||||
`notePosition` INTEGER NOT NULL,
|
||||
`prefix` TEXT,
|
||||
`isExpanded` INTEGER NOT NULL DEFAULT 0,
|
||||
`isDeleted` INTEGER NOT NULL DEFAULT 0,
|
||||
`utcDateModified` TEXT NOT NULL,
|
||||
utcDateCreated TEXT NOT NULL,
|
||||
hash TEXT DEFAULT "" NOT NULL,
|
||||
PRIMARY KEY(`branchId`));
|
||||
CREATE INDEX `IDX_branches_noteId` ON `branches` (`noteId`);
|
||||
CREATE INDEX `IDX_branches_noteId_parentNoteId` ON `branches` (`noteId`,`parentNoteId`);
|
||||
CREATE INDEX IDX_branches_parentNoteId ON branches (parentNoteId);
|
||||
|
||||
@@ -396,7 +396,7 @@ the backend.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line310">line 310</a>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line312">line 312</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1533,7 +1533,7 @@ the backend.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line315">line 315</a>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line317">line 317</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1997,7 +1997,7 @@ the backend.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line239">line 239</a>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line241">line 241</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -2765,7 +2765,7 @@ if some action needs to happen on only one specific instance.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line258">line 258</a>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line260">line 260</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3418,7 +3418,7 @@ if some action needs to happen on only one specific instance.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line230">line 230</a>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line232">line 232</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3596,7 +3596,7 @@ if some action needs to happen on only one specific instance.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line249">line 249</a>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line251">line 251</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3751,7 +3751,7 @@ if some action needs to happen on only one specific instance.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line267">line 267</a>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line269">line 269</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3901,7 +3901,7 @@ if some action needs to happen on only one specific instance.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line222">line 222</a>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line224">line 224</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -4427,7 +4427,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line287">line 287</a>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line289">line 289</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -4560,7 +4560,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line274">line 274</a>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line276">line 276</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -4935,7 +4935,7 @@ transactional by default.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line300">line 300</a>
|
||||
<a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line302">line 302</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class Branch extends Entity {
|
||||
async beforeSaving() {
|
||||
if (this.notePosition === undefined) {
|
||||
const maxNotePos = await sql.getValue('SELECT MAX(notePosition) FROM branches WHERE parentNoteId = ? AND isDeleted = 0', [this.parentNoteId]);
|
||||
this.notePosition = maxNotePos === null ? 0 : maxNotePos + 1;
|
||||
this.notePosition = maxNotePos === null ? 0 : maxNotePos + 10;
|
||||
}
|
||||
|
||||
if (!this.isDeleted) {
|
||||
|
||||
@@ -237,9 +237,11 @@ function BackendScriptApi(currentNote, apiParams) {
|
||||
* @returns {Promise<{note: Note, branch: Branch}>} object contains newly created entities note and branch
|
||||
*/
|
||||
this.createNoteAndRefresh = async function(parentNoteId, title, content, extraOptions) {
|
||||
await noteService.createNote(parentNoteId, title, content, extraOptions);
|
||||
const ret = await noteService.createNote(parentNoteId, title, content, extraOptions);
|
||||
|
||||
ws.refreshTree();
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -343,7 +345,8 @@ function BackendScriptApi(currentNote, apiParams) {
|
||||
this.getAppInfo = () => appInfo
|
||||
}
|
||||
|
||||
module.exports = BackendScriptApi;</code></pre>
|
||||
module.exports = BackendScriptApi;
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line19">line 19</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line21">line 21</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -131,6 +131,116 @@
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="$container"><span class="type-signature"></span>$container<span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5 class="subsection-title">Properties:</h5>
|
||||
|
||||
|
||||
|
||||
<table class="props">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>container</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">jQuery</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last">of all the rendered script content</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line25">line 25</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="currentNote"><span class="type-signature"></span>currentNote<span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
@@ -223,7 +333,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line25">line 25</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line30">line 30</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -336,7 +446,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line27">line 27</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line32">line 32</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -442,7 +552,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line36">line 36</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line41">line 41</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -552,7 +662,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line23">line 23</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line28">line 28</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -661,7 +771,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line33">line 33</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line38">line 38</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -790,7 +900,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line61">line 61</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line66">line 66</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -945,7 +1055,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line45">line 45</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line50">line 50</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1100,7 +1210,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line80">line 80</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line85">line 85</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1280,7 +1390,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line269">line 269</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line273">line 273</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1413,7 +1523,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line229">line 229</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line233">line 233</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1471,7 +1581,7 @@
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="getActiveNote"><span class="type-signature"></span>getActiveNote<span class="signature">()</span><span class="type-signature"> → {<a href="NoteFull.html">NoteFull</a>}</span></h4>
|
||||
<h4 class="name" id="getActiveTabNote"><span class="type-signature"></span>getActiveTabNote<span class="signature">()</span><span class="type-signature"> → {<a href="NoteFull.html">NoteFull</a>}</span></h4>
|
||||
|
||||
|
||||
|
||||
@@ -1519,7 +1629,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line275">line 275</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line279">line 279</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1577,7 +1687,7 @@
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="getActiveNotePath"><span class="type-signature"></span>getActiveNotePath<span class="signature">()</span><span class="type-signature"> → {Promise.<(string|null)>}</span></h4>
|
||||
<h4 class="name" id="getActiveTabNotePath"><span class="type-signature"></span>getActiveTabNotePath<span class="signature">()</span><span class="type-signature"> → {Promise.<(string|null)>}</span></h4>
|
||||
|
||||
|
||||
|
||||
@@ -1625,7 +1735,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line281">line 281</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line285">line 285</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1891,7 +2001,7 @@ if some action needs to happen on only one specific instance.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line222">line 222</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line226">line 226</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -2202,7 +2312,7 @@ if some action needs to happen on only one specific instance.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line190">line 190</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line200">line 200</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -2403,7 +2513,7 @@ otherwise (by e.g. createNoteLink())
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line202">line 202</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line212">line 212</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3061,7 +3171,7 @@ note.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line236">line 236</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line240">line 240</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3255,7 +3365,7 @@ note.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line260">line 260</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line264">line 264</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3309,7 +3419,7 @@ note.
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="reloadChildren"><span class="type-signature"></span>reloadChildren<span class="signature">(noteId)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="reloadNotes"><span class="type-signature"></span>reloadNotes<span class="signature">(noteIds)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
|
||||
@@ -3349,13 +3459,13 @@ note.
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>noteId</code></td>
|
||||
<td class="name"><code>noteIds</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">string</span>
|
||||
<span class="param-type">Array.<string></span>
|
||||
|
||||
|
||||
|
||||
@@ -3406,140 +3516,7 @@ note.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line208">line 208</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="reloadParents"><span class="type-signature"></span>reloadParents<span class="signature">(noteId)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>noteId</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">string</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line214">line 214</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line218">line 218</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3700,7 +3677,7 @@ Internally this serializes the anonymous function into string and sends it to ba
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line130">line 130</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line135">line 135</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3860,7 +3837,7 @@ Internally this serializes the anonymous function into string and sends it to ba
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line178">line 178</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line188">line 188</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -4016,7 +3993,7 @@ Internally this serializes the anonymous function into string and sends it to ba
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line160">line 160</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line170">line 170</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -4070,6 +4047,161 @@ Internally this serializes the anonymous function into string and sends it to ba
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="setHoistedNoteId"><span class="type-signature"></span>setHoistedNoteId<span class="signature">(noteId)</span><span class="type-signature"> → {Promise}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="description">
|
||||
Hoist note. See https://github.com/zadam/trilium/wiki/Note-hoisting
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>noteId</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">string</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last">set hoisted note. 'root' will effectively unhoist</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line359">line 359</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
|
||||
|
||||
<dl>
|
||||
<dt>
|
||||
Type
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<span class="param-type">Promise</span>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="setupElementTooltip"><span class="type-signature"></span>setupElementTooltip<span class="signature">($el)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
@@ -4304,7 +4436,7 @@ Internally this serializes the anonymous function into string and sends it to ba
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line252">line 252</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line256">line 256</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -4441,7 +4573,7 @@ Internally this serializes the anonymous function into string and sends it to ba
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line244">line 244</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line248">line 248</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
@@ -28,9 +28,12 @@
|
||||
|
||||
<header>
|
||||
|
||||
<h2><span class="attribs"><span class="type-signature"></span></span>NoteShort<span class="signature">()</span><span class="type-signature"></span></h2>
|
||||
<h2><span class="attribs"><span class="type-signature"></span></span>NoteShort<span class="signature">(treeCache, row, branches)</span><span class="type-signature"></span></h2>
|
||||
|
||||
<div class="class-description">This note's representation is used in note tree and is kept in TreeCache.</div>
|
||||
<div class="class-description">FIXME: rethink how attributes are cached in Note entities since they are long lived inside the cache.
|
||||
Attribute cache should be limited to "transaction".
|
||||
|
||||
This note's representation is used in note tree and is kept in TreeCache.</div>
|
||||
|
||||
|
||||
</header>
|
||||
@@ -45,7 +48,7 @@
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="NoteShort"><span class="type-signature"></span>new NoteShort<span class="signature">()</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="NoteShort"><span class="type-signature"></span>new NoteShort<span class="signature">(treeCache, row, branches)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
|
||||
@@ -60,6 +63,101 @@
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>treeCache</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">TreeCache</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>row</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">Object.<string, Object></span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>branches</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">Array.<<a href="Branch.html">Branch</a>></span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last">all relevant branches, i.e. where this note is either child or parent</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -93,7 +191,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line13">line 13</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line22">line 22</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -183,7 +281,143 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line26">line 26</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line35">line 35</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="children"><span class="type-signature"></span>children<span class="type-signature"> :Array.<string></span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Type:</h5>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<span class="param-type">Array.<string></span>
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line42">line 42</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="childToBranch"><span class="type-signature"></span>childToBranch<span class="type-signature"> :Object.<string, string></span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Type:</h5>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<span class="param-type">Object.<string, string></span>
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line48">line 48</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -241,7 +475,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line28">line 28</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line37">line 37</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -299,7 +533,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line20">line 20</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line29">line 29</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -357,7 +591,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line24">line 24</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line33">line 33</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -415,7 +649,143 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line16">line 16</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line25">line 25</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="parents"><span class="type-signature"></span>parents<span class="type-signature"> :Array.<string></span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Type:</h5>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<span class="param-type">Array.<string></span>
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line40">line 40</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="parentToBranch"><span class="type-signature"></span>parentToBranch<span class="type-signature"> :Object.<string, string></span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Type:</h5>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<span class="param-type">Object.<string, string></span>
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line45">line 45</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -473,7 +843,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line18">line 18</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line27">line 27</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -531,7 +901,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line22">line 22</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line31">line 31</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -679,7 +1049,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line166">line 166</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line217">line 217</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -846,7 +1216,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line106">line 106</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line157">line 157</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1020,7 +1390,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line177">line 177</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line228">line 228</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1126,7 +1496,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line57">line 57</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line115">line 115</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1228,7 +1598,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line71">line 71</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line127">line 127</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1330,7 +1700,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line93">line 93</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line144">line 144</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1432,7 +1802,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line98">line 98</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line149">line 149</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1583,7 +1953,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line199">line 199</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line250">line 250</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1750,7 +2120,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line132">line 132</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line183">line 183</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -1917,7 +2287,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line124">line 124</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line175">line 175</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -2072,7 +2442,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line211">line 211</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line262">line 262</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -2178,7 +2548,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line83">line 83</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line134">line 134</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -2280,7 +2650,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line88">line 88</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line139">line 139</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -2431,7 +2801,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line205">line 205</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line256">line 256</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -2598,7 +2968,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line148">line 148</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line199">line 199</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -2765,7 +3135,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line140">line 140</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line191">line 191</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -2920,7 +3290,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line223">line 223</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line274">line 274</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3090,7 +3460,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line233">line 233</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line284">line 284</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3241,7 +3611,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line217">line 217</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line268">line 268</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3351,7 +3721,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line257">line 257</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line308">line 308</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3525,7 +3895,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line157">line 157</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line208">line 208</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3631,7 +4001,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line65">line 65</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line122">line 122</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3782,7 +4152,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line187">line 187</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line238">line 238</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -3937,7 +4307,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line193">line 193</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line244">line 244</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -4048,7 +4418,7 @@ Cache is note instance scoped.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line248">line 248</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line299">line 299</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -4132,7 +4502,7 @@ Cache is note instance scoped.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line32">line 32</a>
|
||||
<a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line90">line 90</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
* Represents full note, specifically including note's content.
|
||||
*/
|
||||
class NoteFull extends NoteShort {
|
||||
constructor(treeCache, row) {
|
||||
super(treeCache, row);
|
||||
constructor(treeCache, row, noteShort) {
|
||||
super(treeCache, row, []);
|
||||
|
||||
/** @param {string} */
|
||||
this.content = row.content;
|
||||
@@ -49,6 +49,12 @@ class NoteFull extends NoteShort {
|
||||
|
||||
/** @param {string} */
|
||||
this.utcDateModified = row.utcDateModified;
|
||||
|
||||
/* ugly */
|
||||
this.parents = noteShort.parents;
|
||||
this.parentToBranch = noteShort.parentToBranch;
|
||||
this.children = noteShort.children;
|
||||
this.childToBranch = noteShort.childToBranch;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>import server from '../services/server.js';
|
||||
import Attribute from './attribute.js';
|
||||
import branches from "../services/branches.js";
|
||||
|
||||
const LABEL = 'label';
|
||||
const LABEL_DEFINITION = 'label-definition';
|
||||
@@ -35,10 +36,18 @@ const RELATION = 'relation';
|
||||
const RELATION_DEFINITION = 'relation-definition';
|
||||
|
||||
/**
|
||||
* FIXME: rethink how attributes are cached in Note entities since they are long lived inside the cache.
|
||||
* Attribute cache should be limited to "transaction".
|
||||
*
|
||||
* This note's representation is used in note tree and is kept in TreeCache.
|
||||
*/
|
||||
class NoteShort {
|
||||
constructor(treeCache, row) {
|
||||
/**
|
||||
* @param {TreeCache} treeCache
|
||||
* @param {Object.<string, Object>} row
|
||||
* @param {Branch[]} branches - all relevant branches, i.e. where this note is either child or parent
|
||||
*/
|
||||
constructor(treeCache, row, branches) {
|
||||
this.treeCache = treeCache;
|
||||
/** @param {string} */
|
||||
this.noteId = row.noteId;
|
||||
@@ -54,6 +63,55 @@ class NoteShort {
|
||||
this.archived = row.archived;
|
||||
/** @param {string} */
|
||||
this.cssClass = row.cssClass;
|
||||
|
||||
/** @type {string[]} */
|
||||
this.parents = [];
|
||||
/** @type {string[]} */
|
||||
this.children = [];
|
||||
|
||||
/** @type {Object.<string, string>} */
|
||||
this.parentToBranch = {};
|
||||
|
||||
/** @type {Object.<string, string>} */
|
||||
this.childToBranch = {};
|
||||
|
||||
for (const branch of branches) {
|
||||
if (this.noteId === branch.noteId) {
|
||||
this.parents.push(branch.parentNoteId);
|
||||
this.parentToBranch[branch.parentNoteId] = branch.branchId;
|
||||
}
|
||||
else if (this.noteId === branch.parentNoteId) {
|
||||
this.children.push(branch.noteId);
|
||||
this.childToBranch[branch.noteId] = branch.branchId;
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unknown branch ${branch.branchId} for note ${this.noteId}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addParent(parentNoteId, branchId) {
|
||||
if (!this.parents.includes(parentNoteId)) {
|
||||
this.parents.push(parentNoteId);
|
||||
}
|
||||
|
||||
this.parentToBranch[parentNoteId] = branchId;
|
||||
}
|
||||
|
||||
addChild(childNoteId, branchId) {
|
||||
if (!this.children.includes(childNoteId)) {
|
||||
this.children.push(childNoteId);
|
||||
}
|
||||
|
||||
this.childToBranch[childNoteId] = branchId;
|
||||
|
||||
const branchIdPos = {};
|
||||
|
||||
for (const branchId of Object.values(this.childToBranch)) {
|
||||
branchIdPos[branchId] = this.treeCache.branches[branchId].notePosition;
|
||||
}
|
||||
|
||||
this.children.sort((a, b) => branchIdPos[this.childToBranch[a]] < branchIdPos[this.childToBranch[b]] ? -1 : 1);
|
||||
}
|
||||
|
||||
/** @returns {boolean} */
|
||||
@@ -83,48 +141,41 @@ class NoteShort {
|
||||
|
||||
/** @returns {Promise<Branch[]>} */
|
||||
async getBranches() {
|
||||
const branchIds = this.treeCache.parents[this.noteId].map(
|
||||
parentNoteId => this.treeCache.getBranchIdByChildParent(this.noteId, parentNoteId));
|
||||
const branchIds = Object.values(this.parentToBranch);
|
||||
|
||||
return this.treeCache.getBranches(branchIds);
|
||||
}
|
||||
|
||||
/** @returns {boolean} */
|
||||
hasChildren() {
|
||||
return this.treeCache.children[this.noteId]
|
||||
&& this.treeCache.children[this.noteId].length > 0;
|
||||
return this.children.length > 0;
|
||||
}
|
||||
|
||||
/** @returns {Promise<Branch[]>} */
|
||||
async getChildBranches() {
|
||||
if (!this.treeCache.children[this.noteId]) {
|
||||
return [];
|
||||
}
|
||||
const branchIds = Object.values(this.childToBranch);
|
||||
|
||||
const branchIds = this.treeCache.children[this.noteId].map(
|
||||
childNoteId => this.treeCache.getBranchIdByChildParent(childNoteId, this.noteId));
|
||||
|
||||
return await this.treeCache.getBranches(branchIds);
|
||||
return this.treeCache.getBranches(branchIds);
|
||||
}
|
||||
|
||||
/** @returns {string[]} */
|
||||
getParentNoteIds() {
|
||||
return this.treeCache.parents[this.noteId] || [];
|
||||
return this.parents;
|
||||
}
|
||||
|
||||
/** @returns {Promise<NoteShort[]>} */
|
||||
async getParentNotes() {
|
||||
return await this.treeCache.getNotes(this.getParentNoteIds());
|
||||
return await this.treeCache.getNotes(this.parents);
|
||||
}
|
||||
|
||||
/** @returns {string[]} */
|
||||
getChildNoteIds() {
|
||||
return this.treeCache.children[this.noteId] || [];
|
||||
return this.children;
|
||||
}
|
||||
|
||||
/** @returns {Promise<NoteShort[]>} */
|
||||
async getChildNotes() {
|
||||
return await this.treeCache.getNotes(this.getChildNoteIds());
|
||||
return await this.treeCache.getNotes(this.children);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -303,7 +303,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line67">line 67</a>
|
||||
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line72">line 72</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<pre class="prettyprint source linenums"><code>import treeService from './tree.js';
|
||||
import server from './server.js';
|
||||
import utils from './utils.js';
|
||||
import infoService from './info.js';
|
||||
import toastService from './toast.js';
|
||||
import linkService from './link.js';
|
||||
import treeCache from './tree_cache.js';
|
||||
import noteDetailService from './note_detail.js';
|
||||
@@ -37,6 +37,8 @@ import noteTooltipService from './note_tooltip.js';
|
||||
import protectedSessionService from './protected_session.js';
|
||||
import dateNotesService from './date_notes.js';
|
||||
import StandardWidget from '../widgets/standard_widget.js';
|
||||
import ws from "./ws.js";
|
||||
import hoistedNoteService from "./hoisted_note.js";
|
||||
|
||||
/**
|
||||
* This is the main frontend API interface for scripts. It's published in the local "api" object.
|
||||
@@ -44,9 +46,12 @@ import StandardWidget from '../widgets/standard_widget.js';
|
||||
* @constructor
|
||||
* @hideconstructor
|
||||
*/
|
||||
function FrontendScriptApi(startNote, currentNote, originEntity = null, tabContext = null) {
|
||||
function FrontendScriptApi(startNote, currentNote, originEntity = null, tabContext = null, $container = null) {
|
||||
const $pluginButtons = $("#plugin-buttons");
|
||||
|
||||
/** @property {jQuery} container of all the rendered script content */
|
||||
this.$container = $container;
|
||||
|
||||
/** @property {object} note where script started executing */
|
||||
this.startNote = startNote;
|
||||
/** @property {object} note where script is currently executing */
|
||||
@@ -167,9 +172,14 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
currentNoteId: currentNote.noteId,
|
||||
originEntityName: "notes", // currently there's no other entity on frontend which can trigger event
|
||||
originEntityId: originEntity ? originEntity.noteId : null
|
||||
}, {
|
||||
'trilium-source-id': "script"
|
||||
});
|
||||
|
||||
if (ret.success) {
|
||||
// wait until all the changes done in the script has been synced to frontend before continuing
|
||||
await ws.waitForSyncId(ret.maxSyncId);
|
||||
|
||||
return ret.executionResult;
|
||||
}
|
||||
else {
|
||||
@@ -230,16 +240,10 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
this.getNotes = async (noteIds, silentNotFoundError = false) => await treeCache.getNotes(noteIds, silentNotFoundError);
|
||||
|
||||
/**
|
||||
* @param {string} noteId
|
||||
* @param {string[]} noteIds
|
||||
* @method
|
||||
*/
|
||||
this.reloadChildren = async noteId => await treeCache.reloadChildren(noteId);
|
||||
|
||||
/**
|
||||
* @param {string} noteId
|
||||
* @method
|
||||
*/
|
||||
this.reloadParents = async noteId => await treeCache.reloadParents(noteId);
|
||||
this.reloadNotes = async noteIds => await treeCache.reloadNotes(noteIds);
|
||||
|
||||
/**
|
||||
* Instance name identifies particular Trilium instance. It can be useful for scripts
|
||||
@@ -269,7 +273,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
* @method
|
||||
* @param {string} message
|
||||
*/
|
||||
this.showMessage = infoService.showMessage;
|
||||
this.showMessage = toastService.showMessage;
|
||||
|
||||
/**
|
||||
* Show error message to the user.
|
||||
@@ -277,7 +281,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
* @method
|
||||
* @param {string} message
|
||||
*/
|
||||
this.showError = infoService.showError;
|
||||
this.showError = toastService.showError;
|
||||
|
||||
/**
|
||||
* Refresh tree
|
||||
@@ -300,17 +304,13 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
* @method
|
||||
* @returns {NoteFull} active note (loaded into right pane)
|
||||
*/
|
||||
this.getActiveNote = noteDetailService.getActiveNote;
|
||||
this.getActiveTabNote = noteDetailService.getActiveTabNote;
|
||||
|
||||
/**
|
||||
* @method
|
||||
* @returns {Promise<string|null>} returns note path of active note or null if there isn't active note
|
||||
*/
|
||||
this.getActiveNotePath = () => {
|
||||
const activeTabContext = noteDetailService.getActiveTabContext();
|
||||
|
||||
return activeTabContext ? activeTabContext.notePath : null;
|
||||
};
|
||||
this.getActiveTabNotePath = noteDetailService.getActiveTabNotePath;
|
||||
|
||||
/**
|
||||
* This method checks whether user navigated away from the note from which the scripts has been started.
|
||||
@@ -322,7 +322,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
* @return {boolean} returns true if the original note is still loaded, false if user switched to another
|
||||
*/
|
||||
this.isNoteStillActive = () => {
|
||||
return this.originEntity.noteId === tabContext.noteId;
|
||||
return tabContext.note && this.originEntity.noteId === tabContext.note.noteId;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -376,6 +376,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
* @return {Promise<NoteShort>}
|
||||
*/
|
||||
this.getYearNote = dateNotesService.getYearNote;
|
||||
|
||||
/**
|
||||
* Hoist note. See https://github.com/zadam/trilium/wiki/Note-hoisting
|
||||
*
|
||||
* @method
|
||||
* @param {string} noteId - set hoisted note. 'root' will effectively unhoist
|
||||
* @return {Promise}
|
||||
*/
|
||||
this.setHoistedNoteId = hoistedNoteService.setHoistedNoteId;
|
||||
}
|
||||
|
||||
export default FrontendScriptApi;</code></pre>
|
||||
|
||||
46
electron.js
46
electron.js
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const {app, globalShortcut, BrowserWindow} = require('electron');
|
||||
const path = require('path');
|
||||
const log = require('./src/services/log');
|
||||
const sqlInit = require('./src/services/sql_init');
|
||||
@@ -10,10 +10,6 @@ const port = require('./src/services/port');
|
||||
const env = require('./src/services/env');
|
||||
const appIconService = require('./src/services/app_icon');
|
||||
const windowStateKeeper = require('electron-window-state');
|
||||
const contextMenu = require('electron-context-menu');
|
||||
|
||||
const app = electron.app;
|
||||
const globalShortcut = electron.globalShortcut;
|
||||
|
||||
// Adds debug features like hotkeys for triggering dev tools and reload
|
||||
require('electron-debug')();
|
||||
@@ -25,25 +21,25 @@ let mainWindow;
|
||||
|
||||
require('electron-dl')({ saveAs: true });
|
||||
|
||||
contextMenu({
|
||||
menu: (actions, params, browserWindow) => [
|
||||
actions.cut(),
|
||||
actions.copy(),
|
||||
actions.copyLink(),
|
||||
actions.paste(),
|
||||
{
|
||||
label: 'Search DuckDuckGo for “{selection}”',
|
||||
// Only show it when right-clicking text
|
||||
visible: params.selectionText.trim().length > 0,
|
||||
click: () => {
|
||||
const {shell} = require('electron');
|
||||
|
||||
shell.openExternal(`https://duckduckgo.com?q=${encodeURIComponent(params.selectionText)}`);
|
||||
}
|
||||
},
|
||||
actions.inspect()
|
||||
]
|
||||
});
|
||||
// contextMenu({
|
||||
// menu: (actions, params, browserWindow) => [
|
||||
// actions.cut(),
|
||||
// actions.copy(),
|
||||
// actions.copyLink(),
|
||||
// actions.paste(),
|
||||
// {
|
||||
// label: 'Search DuckDuckGo for “{selection}”',
|
||||
// // Only show it when right-clicking text
|
||||
// visible: params.selectionText.trim().length > 0,
|
||||
// click: () => {
|
||||
// const {shell} = require('electron');
|
||||
//
|
||||
// shell.openExternal(`https://duckduckgo.com?q=${encodeURIComponent(params.selectionText)}`);
|
||||
// }
|
||||
// },
|
||||
// actions.inspect()
|
||||
// ]
|
||||
// });
|
||||
|
||||
function onClosed() {
|
||||
// Dereference the window
|
||||
@@ -66,7 +62,7 @@ async function createMainWindow() {
|
||||
defaultHeight: 800
|
||||
});
|
||||
|
||||
const win = new electron.BrowserWindow({
|
||||
const win = new BrowserWindow({
|
||||
x: mainWindowState.x,
|
||||
y: mainWindowState.y,
|
||||
width: mainWindowState.width,
|
||||
|
||||
4
libraries/autocomplete.jquery.min.js
vendored
4
libraries/autocomplete.jquery.min.js
vendored
File diff suppressed because one or more lines are too long
2
libraries/bootstrap-notify.min.js
vendored
2
libraries/bootstrap-notify.min.js
vendored
File diff suppressed because one or more lines are too long
2
libraries/ckeditor/ckeditor.js
vendored
2
libraries/ckeditor/ckeditor.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
libraries/codemirror/addon/lint/eslint.js
vendored
4
libraries/codemirror/addon/lint/eslint.js
vendored
@@ -29,8 +29,8 @@
|
||||
|
||||
async function validatorJavaScript(text, options) {
|
||||
if (glob.isMobile()
|
||||
|| glob.getActiveNote() == null
|
||||
|| glob.getActiveNote().mime === 'application/json') {
|
||||
|| glob.getActiveTabNote() == null
|
||||
|| glob.getActiveTabNote().mime === 'application/json') {
|
||||
// eslint doesn't seem to validate pure JSON well
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*! jQuery Fancytree Plugin - 2.32.0 - 2019-09-10T07:42:12Z
|
||||
/*! jQuery Fancytree Plugin - 2.33.0 - 2019-10-29T08:00:07Z
|
||||
* https://github.com/mar10/fancytree
|
||||
* Copyright (c) 2019 Martin Wendt; Licensed MIT
|
||||
*/
|
||||
@@ -1365,8 +1365,8 @@ var uniqueId = $.fn.extend( {
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
*/
|
||||
|
||||
/** Core Fancytree module.
|
||||
@@ -2947,15 +2947,7 @@ var uniqueId = $.fn.extend( {
|
||||
// i.e. return false for nodes (but not parents) that are hidden
|
||||
// by a filter
|
||||
if (hasFilter && !this.match && !this.subMatchCount) {
|
||||
this.debug(
|
||||
"isVisible: HIDDEN (" +
|
||||
hasFilter +
|
||||
", " +
|
||||
this.match +
|
||||
", " +
|
||||
this.match +
|
||||
")"
|
||||
);
|
||||
// this.debug( "isVisible: HIDDEN (" + hasFilter + ", " + this.match + ", " + this.match + ")" );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2963,7 +2955,7 @@ var uniqueId = $.fn.extend( {
|
||||
n = parents[i];
|
||||
|
||||
if (!n.expanded) {
|
||||
this.debug("isVisible: HIDDEN (parent collapsed)");
|
||||
// this.debug("isVisible: HIDDEN (parent collapsed)");
|
||||
return false;
|
||||
}
|
||||
// if (hasFilter && !n.match && !n.subMatchCount) {
|
||||
@@ -2971,7 +2963,7 @@ var uniqueId = $.fn.extend( {
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
this.debug("isVisible: VISIBLE");
|
||||
// this.debug("isVisible: VISIBLE");
|
||||
return true;
|
||||
},
|
||||
/** Deprecated.
|
||||
@@ -4788,6 +4780,10 @@ var uniqueId = $.fn.extend( {
|
||||
},
|
||||
/**
|
||||
* Return an array of selected nodes.
|
||||
*
|
||||
* Note: you cannot send this result via Ajax directly. Instead the
|
||||
* node object need to be converted to plain objects, for example
|
||||
* by using `$.map()` and `node.toDict()`.
|
||||
* @param {boolean} [stopOnParents=false] only return the topmost selected
|
||||
* node (useful with selectMode 3)
|
||||
* @returns {FancytreeNode[]}
|
||||
@@ -6714,7 +6710,13 @@ var uniqueId = $.fn.extend( {
|
||||
dfd.done(function() {
|
||||
var lastChild = node.getLastChild();
|
||||
|
||||
if (flag && opts.autoScroll && !noAnimation && lastChild) {
|
||||
if (
|
||||
flag &&
|
||||
opts.autoScroll &&
|
||||
!noAnimation &&
|
||||
lastChild &&
|
||||
tree._enableUpdate
|
||||
) {
|
||||
// Scroll down to last child, but keep current node visible
|
||||
lastChild
|
||||
.scrollIntoView(true, { topNode: node })
|
||||
@@ -6773,9 +6775,7 @@ var uniqueId = $.fn.extend( {
|
||||
$(node.li).addClass(cn.animating); // #717
|
||||
|
||||
if ($.isFunction($(node.ul)[effect.effect])) {
|
||||
tree.debug(
|
||||
"use jquery." + effect.effect + " method"
|
||||
);
|
||||
// tree.debug( "use jquery." + effect.effect + " method" );
|
||||
$(node.ul)[effect.effect]({
|
||||
duration: effect.duration,
|
||||
always: function() {
|
||||
@@ -7263,16 +7263,30 @@ var uniqueId = $.fn.extend( {
|
||||
type = $container.data("type") || "html";
|
||||
switch (type) {
|
||||
case "html":
|
||||
$ul = $container.find(">ul").first();
|
||||
$ul.addClass(
|
||||
"ui-fancytree-source fancytree-helper-hidden"
|
||||
);
|
||||
source = $.ui.fancytree.parseHtml($ul);
|
||||
// allow to init tree.data.foo from <ul data-foo=''>
|
||||
this.data = $.extend(
|
||||
this.data,
|
||||
_getElementDataAsDict($ul)
|
||||
);
|
||||
// There should be an embedded `<ul>` with initial nodes,
|
||||
// but another `<ul class='fancytree-container'>` is appended
|
||||
// to the tree's <div> on startup anyway.
|
||||
$ul = $container
|
||||
.find(">ul")
|
||||
.not(".fancytree-container")
|
||||
.first();
|
||||
|
||||
if ($ul.length) {
|
||||
$ul.addClass(
|
||||
"ui-fancytree-source fancytree-helper-hidden"
|
||||
);
|
||||
source = $.ui.fancytree.parseHtml($ul);
|
||||
// allow to init tree.data.foo from <ul data-foo=''>
|
||||
this.data = $.extend(
|
||||
this.data,
|
||||
_getElementDataAsDict($ul)
|
||||
);
|
||||
} else {
|
||||
FT.warn(
|
||||
"No `source` option was passed and container does not contain `<ul>`: assuming `source: []`."
|
||||
);
|
||||
source = [];
|
||||
}
|
||||
break;
|
||||
case "json":
|
||||
source = $.parseJSON($container.text());
|
||||
@@ -7312,8 +7326,9 @@ var uniqueId = $.fn.extend( {
|
||||
$.error("Not implemented");
|
||||
}
|
||||
|
||||
// TODO: might be useful? Let's wait for a use case...
|
||||
// tree._triggerTreeEvent("beforeInitLoad", null);
|
||||
// preInit is fired when the widget markup is created, but nodes
|
||||
// not yet loaded
|
||||
tree._triggerTreeEvent("preInit", null);
|
||||
|
||||
// Trigger fancytreeinit after nodes have been loaded
|
||||
dfd = this.nodeLoadChildren(rootCtx, source)
|
||||
@@ -7927,7 +7942,7 @@ var uniqueId = $.fn.extend( {
|
||||
/** @lends Fancytree_Static# */
|
||||
{
|
||||
/** @type {string} */
|
||||
version: "2.32.0", // Set to semver by 'grunt release'
|
||||
version: "2.33.0", // Set to semver by 'grunt release'
|
||||
/** @type {string} */
|
||||
buildType: "production", // Set to 'production' by 'grunt build'
|
||||
/** @type {int} */
|
||||
@@ -8550,8 +8565,8 @@ var uniqueId = $.fn.extend( {
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
*/
|
||||
|
||||
// To keep the global namespace clean, we wrap everything in a closure.
|
||||
@@ -8670,7 +8685,7 @@ var uniqueId = $.fn.extend( {
|
||||
// Every extension must be registered by a unique name.
|
||||
name: "childcounter",
|
||||
// Version information should be compliant with [semver](http://semver.org)
|
||||
version: "2.32.0",
|
||||
version: "2.33.0",
|
||||
|
||||
// Extension specific options and their defaults.
|
||||
// This options will be available as `tree.options.childcounter.hideExpanded`
|
||||
@@ -8781,8 +8796,8 @@ var uniqueId = $.fn.extend( {
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
*/
|
||||
|
||||
(function(factory) {
|
||||
@@ -9140,7 +9155,7 @@ var uniqueId = $.fn.extend( {
|
||||
*/
|
||||
$.ui.fancytree.registerExtension({
|
||||
name: "clones",
|
||||
version: "2.32.0",
|
||||
version: "2.33.0",
|
||||
// Default options for this extension.
|
||||
options: {
|
||||
highlightActiveClones: true, // set 'fancytree-active-clone' on active clones and all peers
|
||||
@@ -9302,8 +9317,8 @@ var uniqueId = $.fn.extend( {
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -10123,6 +10138,7 @@ var uniqueId = $.fn.extend( {
|
||||
// ": dropEffect: " +
|
||||
// dataTransfer.dropEffect
|
||||
// );
|
||||
prepareDropEffectCallback(event, data);
|
||||
LAST_HIT_MODE = handleDragOver(event, data);
|
||||
|
||||
// The flag controls the preventDefault() below:
|
||||
@@ -10306,7 +10322,7 @@ var uniqueId = $.fn.extend( {
|
||||
|
||||
$.ui.fancytree.registerExtension({
|
||||
name: "dnd5",
|
||||
version: "2.32.0",
|
||||
version: "2.33.0",
|
||||
// Default options for this extension.
|
||||
options: {
|
||||
autoExpandMS: 1500, // Expand nodes after n milliseconds of hovering
|
||||
@@ -10439,8 +10455,8 @@ var uniqueId = $.fn.extend( {
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
*/
|
||||
|
||||
(function(factory) {
|
||||
@@ -10732,7 +10748,7 @@ var uniqueId = $.fn.extend( {
|
||||
*/
|
||||
$.ui.fancytree.registerExtension({
|
||||
name: "edit",
|
||||
version: "2.32.0",
|
||||
version: "2.33.0",
|
||||
// Default options for this extension.
|
||||
options: {
|
||||
adjustWidthOfs: 4, // null: don't adjust input size to content
|
||||
@@ -10843,8 +10859,8 @@ var uniqueId = $.fn.extend( {
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
*/
|
||||
|
||||
(function(factory) {
|
||||
@@ -11008,7 +11024,9 @@ var uniqueId = $.fn.extend( {
|
||||
count++;
|
||||
node.match = true;
|
||||
node.visitParents(function(p) {
|
||||
p.subMatchCount += 1;
|
||||
if (p !== node) {
|
||||
p.subMatchCount += 1;
|
||||
}
|
||||
// Expand match (unless this is no real match, but only a node in a matched branch)
|
||||
if (opts.autoExpand && !matchedByBranch && !p.expanded) {
|
||||
p.setExpanded(true, {
|
||||
@@ -11180,7 +11198,7 @@ var uniqueId = $.fn.extend( {
|
||||
*/
|
||||
$.ui.fancytree.registerExtension({
|
||||
name: "filter",
|
||||
version: "2.32.0",
|
||||
version: "2.33.0",
|
||||
// Default options for this extension.
|
||||
options: {
|
||||
autoApply: true, // Re-apply last filter if lazy data is loaded
|
||||
@@ -11300,8 +11318,8 @@ var uniqueId = $.fn.extend( {
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
*/
|
||||
|
||||
(function(factory) {
|
||||
@@ -11484,7 +11502,7 @@ var uniqueId = $.fn.extend( {
|
||||
|
||||
$.ui.fancytree.registerExtension({
|
||||
name: "glyph",
|
||||
version: "2.32.0",
|
||||
version: "2.33.0",
|
||||
// Default options for this extension.
|
||||
options: {
|
||||
preset: null, // 'awesome3', 'awesome4', 'bootstrap3', 'material'
|
||||
@@ -11638,8 +11656,8 @@ var uniqueId = $.fn.extend( {
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
*/
|
||||
|
||||
(function(factory) {
|
||||
@@ -11756,7 +11774,7 @@ var uniqueId = $.fn.extend( {
|
||||
*/
|
||||
$.ui.fancytree.registerExtension({
|
||||
name: "gridnav",
|
||||
version: "2.32.0",
|
||||
version: "2.33.0",
|
||||
// Default options for this extension.
|
||||
options: {
|
||||
autofocusInput: false, // Focus first embedded input if node gets activated
|
||||
@@ -11863,8 +11881,8 @@ var uniqueId = $.fn.extend( {
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
*/
|
||||
|
||||
(function(factory) {
|
||||
@@ -11893,7 +11911,7 @@ var uniqueId = $.fn.extend( {
|
||||
*/
|
||||
$.ui.fancytree.registerExtension({
|
||||
name: "multi",
|
||||
version: "2.32.0",
|
||||
version: "2.33.0",
|
||||
// Default options for this extension.
|
||||
options: {
|
||||
allowNoSelect: false, //
|
||||
@@ -11995,8 +12013,8 @@ var uniqueId = $.fn.extend( {
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
*/
|
||||
|
||||
(function(factory) {
|
||||
@@ -12196,7 +12214,7 @@ var uniqueId = $.fn.extend( {
|
||||
*/
|
||||
$.ui.fancytree.registerExtension({
|
||||
name: "persist",
|
||||
version: "2.32.0",
|
||||
version: "2.33.0",
|
||||
// Default options for this extension.
|
||||
options: {
|
||||
cookieDelimiter: "~",
|
||||
@@ -12489,8 +12507,8 @@ var uniqueId = $.fn.extend( {
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
*/
|
||||
|
||||
(function(factory) {
|
||||
@@ -12573,7 +12591,7 @@ var uniqueId = $.fn.extend( {
|
||||
|
||||
$.ui.fancytree.registerExtension({
|
||||
name: "table",
|
||||
version: "2.32.0",
|
||||
version: "2.33.0",
|
||||
// Default options for this extension.
|
||||
options: {
|
||||
checkboxColumnIdx: null, // render the checkboxes into the this column index (default: nodeColumnIdx)
|
||||
@@ -13039,8 +13057,8 @@ var uniqueId = $.fn.extend( {
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
*/
|
||||
|
||||
(function(factory) {
|
||||
@@ -13063,7 +13081,7 @@ var uniqueId = $.fn.extend( {
|
||||
*/
|
||||
$.ui.fancytree.registerExtension({
|
||||
name: "themeroller",
|
||||
version: "2.32.0",
|
||||
version: "2.33.0",
|
||||
// Default options for this extension.
|
||||
options: {
|
||||
activeClass: "ui-state-active", // Class added to active node
|
||||
@@ -13159,8 +13177,8 @@ var uniqueId = $.fn.extend( {
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
*/
|
||||
|
||||
(function(factory) {
|
||||
@@ -13290,7 +13308,7 @@ var uniqueId = $.fn.extend( {
|
||||
*/
|
||||
$.ui.fancytree.registerExtension({
|
||||
name: "wide",
|
||||
version: "2.32.0",
|
||||
version: "2.33.0",
|
||||
// Default options for this extension.
|
||||
options: {
|
||||
iconWidth: null, // Adjust this if @fancy-icon-width != "16px"
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -13,8 +13,8 @@
|
||||
* Released under the MIT license
|
||||
* https://github.com/mar10/fancytree/wiki/LicenseInfo
|
||||
*
|
||||
* @version 2.32.0
|
||||
* @date 2019-09-10T07:42:12Z
|
||||
* @version 2.33.0
|
||||
* @date 2019-10-29T08:00:07Z
|
||||
******************************************************************************/
|
||||
/*------------------------------------------------------------------------------
|
||||
* Helpers
|
||||
@@ -121,7 +121,6 @@ span.fancytree-drag-helper-img,
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
background-repeat: no-repeat;
|
||||
background-position: left;
|
||||
background-image: url("../skin-win8/icons.gif");
|
||||
background-position: 0px 0px;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
5011
package-lock.json
generated
5011
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
33
package.json
33
package.json
@@ -2,7 +2,7 @@
|
||||
"name": "trilium",
|
||||
"productName": "Trilium Notes",
|
||||
"description": "Trilium Notes",
|
||||
"version": "0.35.2",
|
||||
"version": "0.36.2",
|
||||
"license": "AGPL-3.0-only",
|
||||
"main": "electron.js",
|
||||
"bin": {
|
||||
@@ -17,8 +17,7 @@
|
||||
"start-electron": "TRILIUM_ENV=dev electron . --disable-gpu",
|
||||
"build-backend-docs": "./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/entities/*.js src/services/backend_script_api.js",
|
||||
"build-frontend-docs": "./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/frontend_api src/public/javascripts/entities/*.js src/public/javascripts/services/frontend_script_api.js",
|
||||
"build-docs": "npm run build-backend-docs && npm run build-frontend-docs",
|
||||
"postinstall": "electron-builder install-app-deps"
|
||||
"build-docs": "npm run build-backend-docs && npm run build-frontend-docs"
|
||||
},
|
||||
"dependencies": {
|
||||
"async-mutex": "0.1.4",
|
||||
@@ -31,32 +30,32 @@
|
||||
"dayjs": "1.8.16",
|
||||
"debug": "4.1.1",
|
||||
"ejs": "2.7.1",
|
||||
"electron-context-menu": "0.15.0",
|
||||
"electron-debug": "3.0.1",
|
||||
"electron-dl": "1.14.0",
|
||||
"electron-find": "1.0.6",
|
||||
"electron-spellchecker": "2.2.0",
|
||||
"electron-window-state": "5.0.3",
|
||||
"express": "4.17.1",
|
||||
"express-session": "1.16.2",
|
||||
"file-type": "12.3.0",
|
||||
"express-session": "1.17.0",
|
||||
"file-type": "12.3.1",
|
||||
"fs-extra": "8.1.0",
|
||||
"helmet": "3.21.1",
|
||||
"helmet": "3.21.2",
|
||||
"html": "1.0.0",
|
||||
"html2plaintext": "2.1.2",
|
||||
"http-proxy-agent": "^2.1.0",
|
||||
"https-proxy-agent": "^2.2.2",
|
||||
"http-proxy-agent": "2.1.0",
|
||||
"https-proxy-agent": "3.0.1",
|
||||
"image-type": "4.1.0",
|
||||
"imagemin": "7.0.0",
|
||||
"imagemin-giflossy": "5.1.10",
|
||||
"imagemin-mozjpeg": "8.0.0",
|
||||
"imagemin-pngquant": "8.0.0",
|
||||
"ini": "1.3.5",
|
||||
"jimp": "0.8.4",
|
||||
"jimp": "0.8.5",
|
||||
"mime-types": "2.1.24",
|
||||
"moment": "2.24.0",
|
||||
"multer": "1.4.2",
|
||||
"node-abi": "2.11.0",
|
||||
"open": "6.4.0",
|
||||
"node-abi": "2.12.0",
|
||||
"open": "7.0.0",
|
||||
"pngjs": "3.4.0",
|
||||
"portscanner": "2.2.0",
|
||||
"rand-token": "0.4.0",
|
||||
@@ -70,22 +69,22 @@
|
||||
"simple-node-logger": "18.12.23",
|
||||
"sqlite": "3.0.3",
|
||||
"sqlite3": "4.1.0",
|
||||
"string-similarity": "^3.0.0",
|
||||
"string-similarity": "3.0.0",
|
||||
"tar-stream": "2.1.0",
|
||||
"turndown": "5.0.3",
|
||||
"turndown-plugin-gfm": "1.0.2",
|
||||
"unescape": "1.0.1",
|
||||
"ws": "7.1.2",
|
||||
"ws": "7.2.0",
|
||||
"xml2js": "0.4.22"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "6.0.12",
|
||||
"electron-builder": "21.2.0",
|
||||
"electron-builder": "22.1.0",
|
||||
"electron-compile": "6.4.4",
|
||||
"electron-installer-debian": "2.0.1",
|
||||
"electron-packager": "14.0.6",
|
||||
"electron-packager": "14.1.0",
|
||||
"electron-rebuild": "1.8.6",
|
||||
"jsdoc": "^3.6.3",
|
||||
"jsdoc": "3.6.3",
|
||||
"lorem-ipsum": "2.0.3",
|
||||
"xo": "0.25.3"
|
||||
},
|
||||
|
||||
@@ -88,7 +88,12 @@ app.use((req, res, next) => {
|
||||
|
||||
// error handler
|
||||
app.use((err, req, res, next) => {
|
||||
if (err && err.message && err.message.includes("Invalid package")) {
|
||||
if (err && err.message && (
|
||||
err.message.includes("Invalid package")
|
||||
|| (err.message.includes("Router not found for request") && err.message.includes("node_modules"))
|
||||
|| (err.message.includes("Router not found for request") && err.message.includes(".js.map"))
|
||||
|| (err.message.includes("Router not found for request") && err.message.includes(".css.map"))
|
||||
)) {
|
||||
// electron 6 outputs a lot of such errors which do not seem important
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -42,7 +42,11 @@ class Branch extends Entity {
|
||||
async beforeSaving() {
|
||||
if (this.notePosition === undefined) {
|
||||
const maxNotePos = await sql.getValue('SELECT MAX(notePosition) FROM branches WHERE parentNoteId = ? AND isDeleted = 0', [this.parentNoteId]);
|
||||
this.notePosition = maxNotePos === null ? 0 : maxNotePos + 1;
|
||||
this.notePosition = maxNotePos === null ? 0 : maxNotePos + 10;
|
||||
}
|
||||
|
||||
if (!this.isExpanded) {
|
||||
this.isExpanded = false;
|
||||
}
|
||||
|
||||
if (!this.isDeleted) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import macInit from './services/mac_init.js';
|
||||
import cssLoader from './services/css_loader.js';
|
||||
import dateNoteService from './services/date_notes.js';
|
||||
import sidebarService from './services/sidebar.js';
|
||||
import importService from './services/import.js';
|
||||
|
||||
window.glob.isDesktop = utils.isDesktop;
|
||||
window.glob.isMobile = utils.isMobile;
|
||||
@@ -42,7 +43,7 @@ window.glob.noteChanged = noteDetailService.noteChanged;
|
||||
window.glob.refreshTree = treeService.reload;
|
||||
|
||||
// required for ESLint plugin
|
||||
window.glob.getActiveNote = noteDetailService.getActiveNote;
|
||||
window.glob.getActiveTabNote = noteDetailService.getActiveTabNote;
|
||||
window.glob.requireLibrary = libraryLoader.requireLibrary;
|
||||
window.glob.ESLINT = libraryLoader.ESLINT;
|
||||
|
||||
@@ -177,3 +178,7 @@ entrypoints.registerEntrypoints();
|
||||
noteTooltipService.setupGlobalTooltip();
|
||||
|
||||
noteAutocompleteService.init();
|
||||
|
||||
if (utils.isElectron()) {
|
||||
import("./services/spell_check.js").then(spellCheckService => spellCheckService.initSpellCheck());
|
||||
}
|
||||
@@ -33,7 +33,7 @@ export async function showDialog(linkType) {
|
||||
|
||||
glob.activeDialog = $dialog;
|
||||
|
||||
if (noteDetailService.getActiveNoteType() === 'text') {
|
||||
if (noteDetailService.getActiveTabNoteType() === 'text') {
|
||||
$linkTypeHtml.prop('disabled', false);
|
||||
|
||||
setLinkType('html');
|
||||
@@ -110,14 +110,14 @@ $form.submit(() => {
|
||||
else if (linkType === 'selected-to-active') {
|
||||
const prefix = $clonePrefix.val();
|
||||
|
||||
cloningService.cloneNoteTo(noteId, noteDetailService.getActiveNoteId(), prefix);
|
||||
cloningService.cloneNoteTo(noteId, noteDetailService.getActiveTabNoteId(), prefix);
|
||||
|
||||
$dialog.modal('hide');
|
||||
}
|
||||
else if (linkType === 'active-to-selected') {
|
||||
const prefix = $clonePrefix.val();
|
||||
|
||||
cloningService.cloneNoteTo(noteDetailService.getActiveNoteId(), noteId, prefix);
|
||||
cloningService.cloneNoteTo(noteDetailService.getActiveTabNoteId(), noteId, prefix);
|
||||
|
||||
$dialog.modal('hide');
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import noteDetailService from '../services/note_detail.js';
|
||||
import server from '../services/server.js';
|
||||
import infoService from "../services/info.js";
|
||||
import toastService from "../services/toast.js";
|
||||
import treeUtils from "../services/tree_utils.js";
|
||||
import attributeAutocompleteService from "../services/attribute_autocomplete.js";
|
||||
import utils from "../services/utils.js";
|
||||
@@ -47,14 +47,15 @@ function AttributesModel() {
|
||||
};
|
||||
|
||||
this.updateAttributePositions = function() {
|
||||
let position = 0;
|
||||
let position = 10;
|
||||
|
||||
// we need to update positions by searching in the DOM, because order of the
|
||||
// attributes in the viewmodel (self.ownedAttributes()) stays the same
|
||||
$ownedAttributesBody.find('input[name="position"]').each(function() {
|
||||
const attribute = self.getTargetAttribute(this);
|
||||
|
||||
attribute().position = position++;
|
||||
attribute().position = position;
|
||||
position += 10;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -91,7 +92,7 @@ function AttributesModel() {
|
||||
}
|
||||
|
||||
this.loadAttributes = async function() {
|
||||
const noteId = noteDetailService.getActiveNoteId();
|
||||
const noteId = noteDetailService.getActiveTabNoteId();
|
||||
|
||||
const attributes = await server.get('notes/' + noteId + '/attributes');
|
||||
|
||||
@@ -137,7 +138,7 @@ function AttributesModel() {
|
||||
|
||||
self.updateAttributePositions();
|
||||
|
||||
const noteId = noteDetailService.getActiveNoteId();
|
||||
const noteId = noteDetailService.getActiveTabNoteId();
|
||||
|
||||
const attributesToSave = self.ownedAttributes()
|
||||
.map(attribute => attribute())
|
||||
@@ -167,7 +168,7 @@ function AttributesModel() {
|
||||
|
||||
await showAttributes(attributes);
|
||||
|
||||
infoService.showMessage("Attributes have been saved.");
|
||||
toastService.showMessage("Attributes have been saved.");
|
||||
|
||||
const ctx = noteDetailService.getActiveTabContext();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import treeService from '../services/tree.js';
|
||||
import server from '../services/server.js';
|
||||
import treeCache from "../services/tree_cache.js";
|
||||
import treeUtils from "../services/tree_utils.js";
|
||||
import infoService from "../services/info.js";
|
||||
import toastService from "../services/toast.js";
|
||||
import utils from "../services/utils.js";
|
||||
|
||||
const $dialog = $("#branch-prefix-dialog");
|
||||
@@ -20,7 +20,7 @@ export async function showDialog(node) {
|
||||
$dialog.modal();
|
||||
|
||||
branchId = node.data.branchId;
|
||||
const branch = await treeCache.getBranch(branchId);
|
||||
const branch = treeCache.getBranch(branchId);
|
||||
|
||||
$treePrefixInput.val(branch.prefix);
|
||||
|
||||
@@ -38,7 +38,7 @@ async function savePrefix() {
|
||||
|
||||
$dialog.modal('hide');
|
||||
|
||||
infoService.showMessage("Branch prefix has been saved.");
|
||||
toastService.showMessage("Branch prefix has been saved.");
|
||||
}
|
||||
|
||||
$form.submit(() => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import treeUtils from "../services/tree_utils.js";
|
||||
import utils from "../services/utils.js";
|
||||
import ws from "../services/ws.js";
|
||||
import infoService from "../services/info.js";
|
||||
import toastService from "../services/toast.js";
|
||||
|
||||
const $dialog = $("#export-dialog");
|
||||
const $form = $("#export-form");
|
||||
@@ -10,22 +10,18 @@ const $subtreeFormats = $("#export-subtree-formats");
|
||||
const $singleFormats = $("#export-single-formats");
|
||||
const $subtreeType = $("#export-type-subtree");
|
||||
const $singleType = $("#export-type-single");
|
||||
const $exportProgressWrapper = $("#export-progress-count-wrapper");
|
||||
const $exportProgressCount = $("#export-progress-count");
|
||||
const $exportButton = $("#export-button");
|
||||
const $opmlVersions = $("#opml-versions");
|
||||
|
||||
let exportId = '';
|
||||
let taskId = '';
|
||||
let branchId = null;
|
||||
|
||||
export async function showDialog(node, defaultType) {
|
||||
utils.closeActiveDialog();
|
||||
|
||||
// each opening of the dialog resets the exportId so we don't associate it with previous exports anymore
|
||||
exportId = '';
|
||||
// each opening of the dialog resets the taskId so we don't associate it with previous exports anymore
|
||||
taskId = '';
|
||||
$exportButton.removeAttr("disabled");
|
||||
$exportProgressWrapper.hide();
|
||||
$exportProgressCount.text('0');
|
||||
|
||||
if (defaultType === 'subtree') {
|
||||
$subtreeType.prop("checked", true).change();
|
||||
@@ -54,8 +50,7 @@ export async function showDialog(node, defaultType) {
|
||||
}
|
||||
|
||||
$form.submit(() => {
|
||||
// disabling so export can't be triggered again
|
||||
$exportButton.attr("disabled", "disabled");
|
||||
$dialog.modal('hide');
|
||||
|
||||
const exportType = $dialog.find("input[name='export-type']:checked").val();
|
||||
|
||||
@@ -77,9 +72,9 @@ $form.submit(() => {
|
||||
});
|
||||
|
||||
function exportBranch(branchId, type, format, version) {
|
||||
exportId = utils.randomString(10);
|
||||
taskId = utils.randomString(10);
|
||||
|
||||
const url = utils.getHost() + `/api/notes/${branchId}/export/${type}/${format}/${version}/${exportId}`;
|
||||
const url = utils.getHost() + `/api/notes/${branchId}/export/${type}/${format}/${version}/${taskId}`;
|
||||
|
||||
utils.download(url);
|
||||
}
|
||||
@@ -112,26 +107,31 @@ $('input[name=export-subtree-format]').change(function () {
|
||||
}
|
||||
});
|
||||
|
||||
function makeToast(id, message) {
|
||||
return {
|
||||
id: id,
|
||||
title: "Export status",
|
||||
message: message,
|
||||
icon: "arrow-square-up-right"
|
||||
};
|
||||
}
|
||||
|
||||
ws.subscribeToMessages(async message => {
|
||||
if (message.type === 'export-error') {
|
||||
infoService.showError(message.message);
|
||||
$dialog.modal('hide');
|
||||
if (message.taskType !== 'export') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!message.exportId || message.exportId !== exportId) {
|
||||
// incoming messages must correspond to this export instance
|
||||
return;
|
||||
if (message.type === 'task-error') {
|
||||
toastService.closePersistent(message.taskId);
|
||||
toastService.showError(message.message);
|
||||
}
|
||||
|
||||
if (message.type === 'export-progress-count') {
|
||||
$exportProgressWrapper.slideDown();
|
||||
|
||||
$exportProgressCount.text(message.progressCount);
|
||||
else if (message.type === 'task-progress-count') {
|
||||
toastService.showPersistent(makeToast(message.taskId, "Export in progress: " + message.progressCount));
|
||||
}
|
||||
else if (message.type === 'export-finished') {
|
||||
$dialog.modal('hide');
|
||||
else if (message.type === 'task-succeeded') {
|
||||
const toast = makeToast(message.taskId, "Import finished successfully.");
|
||||
toast.closeAfter = 5000;
|
||||
|
||||
infoService.showMessage("Export finished successfully.");
|
||||
toastService.showPersistent(toast);
|
||||
}
|
||||
});
|
||||
@@ -1,16 +1,11 @@
|
||||
import treeService from '../services/tree.js';
|
||||
import utils from '../services/utils.js';
|
||||
import treeUtils from "../services/tree_utils.js";
|
||||
import server from "../services/server.js";
|
||||
import infoService from "../services/info.js";
|
||||
import ws from "../services/ws.js";
|
||||
import importService from "../services/import.js";
|
||||
|
||||
const $dialog = $("#import-dialog");
|
||||
const $form = $("#import-form");
|
||||
const $noteTitle = $dialog.find(".import-note-title");
|
||||
const $fileUploadInput = $("#import-file-upload-input");
|
||||
const $importProgressCountWrapper = $("#import-progress-count-wrapper");
|
||||
const $importProgressCount = $("#import-progress-count");
|
||||
const $importButton = $("#import-button");
|
||||
const $safeImportCheckbox = $("#safe-import-checkbox");
|
||||
const $shrinkImagesCheckbox = $("#shrink-images-checkbox");
|
||||
@@ -18,16 +13,11 @@ const $textImportedAsTextCheckbox = $("#text-imported-as-text-checkbox");
|
||||
const $codeImportedAsCodeCheckbox = $("#code-imported-as-code-checkbox");
|
||||
const $explodeArchivesCheckbox = $("#explode-archives-checkbox");
|
||||
|
||||
let importId;
|
||||
let importIntoNoteId = null;
|
||||
let parentNoteId = null;
|
||||
|
||||
export async function showDialog(node) {
|
||||
utils.closeActiveDialog();
|
||||
|
||||
// each opening of the dialog resets the importId so we don't associate it with previous imports anymore
|
||||
importId = '';
|
||||
$importProgressCountWrapper.hide();
|
||||
$importProgressCount.text('0');
|
||||
$fileUploadInput.val('').change(); // to trigger Import button disabling listener below
|
||||
|
||||
$safeImportCheckbox.prop("checked", true);
|
||||
@@ -38,9 +28,9 @@ export async function showDialog(node) {
|
||||
|
||||
glob.activeDialog = $dialog;
|
||||
|
||||
importIntoNoteId = node.data.noteId;
|
||||
parentNoteId = node.data.noteId;
|
||||
|
||||
$noteTitle.text(await treeUtils.getNoteTitle(importIntoNoteId));
|
||||
$noteTitle.text(await treeUtils.getNoteTitle(parentNoteId));
|
||||
|
||||
$dialog.modal();
|
||||
}
|
||||
@@ -49,18 +39,14 @@ $form.submit(() => {
|
||||
// disabling so that import is not triggered again.
|
||||
$importButton.attr("disabled", "disabled");
|
||||
|
||||
importIntoNote(importIntoNoteId);
|
||||
importIntoNote(parentNoteId);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
async function importIntoNote(importNoteId) {
|
||||
async function importIntoNote(parentNoteId) {
|
||||
const files = Array.from($fileUploadInput[0].files); // shallow copy since we're resetting the upload button below
|
||||
|
||||
// we generate it here (and not on opening) for the case when you try to import multiple times from the same
|
||||
// dialog (which shouldn't happen, but still ...)
|
||||
importId = utils.randomString(10);
|
||||
|
||||
const options = {
|
||||
safeImport: boolToString($safeImportCheckbox),
|
||||
shrinkImages: boolToString($shrinkImagesCheckbox),
|
||||
@@ -69,73 +55,15 @@ async function importIntoNote(importNoteId) {
|
||||
explodeArchives: boolToString($explodeArchivesCheckbox)
|
||||
};
|
||||
|
||||
await uploadFiles(importNoteId, files, options);
|
||||
|
||||
$dialog.modal('hide');
|
||||
}
|
||||
|
||||
export async function uploadFiles(importNoteId, files, options) {
|
||||
if (files.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
let noteId;
|
||||
|
||||
for (const file of files) {
|
||||
const formData = new FormData();
|
||||
formData.append('upload', file);
|
||||
formData.append('importId', importId);
|
||||
|
||||
for (const key in options) {
|
||||
formData.append(key, options[key]);
|
||||
}
|
||||
|
||||
({noteId} = await $.ajax({
|
||||
url: baseApiUrl + 'notes/' + importNoteId + '/import',
|
||||
headers: server.getHeaders(),
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
timeout: 60 * 60 * 1000,
|
||||
contentType: false, // NEEDED, DON'T REMOVE THIS
|
||||
processData: false, // NEEDED, DON'T REMOVE THIS
|
||||
}));
|
||||
}
|
||||
|
||||
infoService.showMessage("Import finished successfully.");
|
||||
|
||||
await treeService.reloadNote(importNoteId);
|
||||
|
||||
if (noteId) {
|
||||
const node = await treeService.activateNote(noteId);
|
||||
|
||||
node.setExpanded(true);
|
||||
}
|
||||
await importService.uploadFiles(parentNoteId, files, options);
|
||||
}
|
||||
|
||||
function boolToString($el) {
|
||||
return $el.is(":checked") ? "true" : "false";
|
||||
}
|
||||
|
||||
ws.subscribeToMessages(async message => {
|
||||
if (message.type === 'import-error') {
|
||||
infoService.showError(message.message);
|
||||
$dialog.modal('hide');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!message.importId || message.importId !== importId) {
|
||||
// incoming messages must correspond to this import instance
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.type === 'import-progress-count') {
|
||||
$importProgressCountWrapper.slideDown();
|
||||
|
||||
$importProgressCount.text(message.progressCount);
|
||||
}
|
||||
});
|
||||
|
||||
$fileUploadInput.change(() => {
|
||||
if ($fileUploadInput.val()) {
|
||||
$importButton.removeAttr("disabled");
|
||||
|
||||
@@ -23,7 +23,7 @@ export async function showDialog() {
|
||||
// set default settings
|
||||
$maxNotesInput.val(20);
|
||||
|
||||
const note = noteDetailService.getActiveNote();
|
||||
const note = noteDetailService.getActiveTabNote();
|
||||
|
||||
if (!note) {
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import libraryLoader from "../services/library_loader.js";
|
||||
import infoService from "../services/info.js";
|
||||
import toastService from "../services/toast.js";
|
||||
import utils from "../services/utils.js";
|
||||
import noteDetailService from "../services/note_detail.js";
|
||||
|
||||
@@ -22,7 +22,7 @@ async function convertMarkdownToHtml(text) {
|
||||
|
||||
textEditor.model.insertContent(modelFragment, textEditor.model.document.selection);
|
||||
|
||||
infoService.showMessage("Markdown content has been imported into the document.");
|
||||
toastService.showMessage("Markdown content has been imported into the document.");
|
||||
}
|
||||
|
||||
export async function importMarkdownInline() {
|
||||
|
||||
@@ -16,7 +16,7 @@ export function showDialog() {
|
||||
|
||||
$dialog.modal();
|
||||
|
||||
const activeNote = noteDetailService.getActiveNote();
|
||||
const activeNote = noteDetailService.getActiveTabNote();
|
||||
|
||||
$noteId.text(activeNote.noteId);
|
||||
$dateCreated.text(activeNote.dateCreated);
|
||||
|
||||
@@ -11,7 +11,7 @@ let revisionItems = [];
|
||||
let note;
|
||||
|
||||
export async function showCurrentNoteRevisions() {
|
||||
await showNoteRevisionsDialog(noteDetailService.getActiveNoteId());
|
||||
await showNoteRevisionsDialog(noteDetailService.getActiveTabNoteId());
|
||||
}
|
||||
|
||||
export async function showNoteRevisionsDialog(noteId, noteRevisionId) {
|
||||
@@ -24,7 +24,7 @@ export async function showNoteRevisionsDialog(noteId, noteRevisionId) {
|
||||
$list.empty();
|
||||
$content.empty();
|
||||
|
||||
note = noteDetailService.getActiveNote();
|
||||
note = noteDetailService.getActiveTabNote();
|
||||
revisionItems = await server.get('notes/' + noteId + '/revisions');
|
||||
|
||||
for (const item of revisionItems) {
|
||||
@@ -62,14 +62,4 @@ $list.on('change', () => {
|
||||
else {
|
||||
$content.text("Preview isn't available for this note type.");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', "a[data-action='note-revision']", event => {
|
||||
const linkEl = $(event.target);
|
||||
const noteId = linkEl.attr('data-note-path');
|
||||
const noteRevisionId = linkEl.attr('data-note-revision-id');
|
||||
|
||||
showNoteRevisionsDialog(noteId, noteRevisionId);
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
@@ -11,7 +11,7 @@ export function showDialog() {
|
||||
|
||||
$dialog.modal();
|
||||
|
||||
const noteText = noteDetailService.getActiveNote().content;
|
||||
const noteText = noteDetailService.getActiveTabNote().content;
|
||||
|
||||
$noteSource.text(formatHtml(noteText));
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@ export async function showDialog() {
|
||||
import('./options/appearance.js'),
|
||||
import('./options/code_notes.js'),
|
||||
import('./options/change_password.js'),
|
||||
import('./options/note_revisions.js'),
|
||||
import('./options/protected_session.js'),
|
||||
import('./options/other.js'),
|
||||
import('./options/sidebar.js'),
|
||||
import('./options/sync.js'),
|
||||
]))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import server from "../../services/server.js";
|
||||
import infoService from "../../services/info.js";
|
||||
import toastService from "../../services/toast.js";
|
||||
|
||||
export default class AdvancedOptions {
|
||||
constructor() {
|
||||
@@ -13,26 +13,26 @@ export default class AdvancedOptions {
|
||||
this.$forceFullSyncButton.click(async () => {
|
||||
await server.post('sync/force-full-sync');
|
||||
|
||||
infoService.showMessage("Full sync triggered");
|
||||
toastService.showMessage("Full sync triggered");
|
||||
});
|
||||
|
||||
this.$fillSyncRowsButton.click(async () => {
|
||||
await server.post('sync/fill-sync-rows');
|
||||
|
||||
infoService.showMessage("Sync rows filled successfully");
|
||||
toastService.showMessage("Sync rows filled successfully");
|
||||
});
|
||||
|
||||
this.$anonymizeButton.click(async () => {
|
||||
await server.post('anonymization/anonymize');
|
||||
|
||||
infoService.showMessage("Created anonymized database");
|
||||
toastService.showMessage("Created anonymized database");
|
||||
});
|
||||
|
||||
this.$cleanupSoftDeletedButton.click(async () => {
|
||||
if (confirm("Do you really want to clean up soft-deleted items?")) {
|
||||
await server.post('cleanup/cleanup-soft-deleted-items');
|
||||
|
||||
infoService.showMessage("Soft deleted items have been cleaned up");
|
||||
toastService.showMessage("Soft deleted items have been cleaned up");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -40,14 +40,14 @@ export default class AdvancedOptions {
|
||||
if (confirm("Do you really want to clean up unused images?")) {
|
||||
await server.post('cleanup/cleanup-unused-images');
|
||||
|
||||
infoService.showMessage("Unused images have been cleaned up");
|
||||
toastService.showMessage("Unused images have been cleaned up");
|
||||
}
|
||||
});
|
||||
|
||||
this.$vacuumDatabaseButton.click(async () => {
|
||||
await server.post('cleanup/vacuum-database');
|
||||
|
||||
infoService.showMessage("Database has been vacuumed");
|
||||
toastService.showMessage("Database has been vacuumed");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import server from "../../services/server.js";
|
||||
import protectedSessionHolder from "../../services/protected_session_holder.js";
|
||||
import infoService from "../../services/info.js";
|
||||
import toastService from "../../services/toast.js";
|
||||
|
||||
export default class ChangePasswordOptions {
|
||||
constructor() {
|
||||
@@ -39,7 +39,7 @@ export default class ChangePasswordOptions {
|
||||
protectedSessionHolder.resetProtectedSession();
|
||||
}
|
||||
else {
|
||||
infoService.showError(result.message);
|
||||
toastService.showError(result.message);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import server from "../../services/server.js";
|
||||
import infoService from "../../services/info.js";
|
||||
|
||||
export default class NoteRevisionsOptions {
|
||||
constructor() {
|
||||
this.$form = $("#note-revision-snapshot-time-interval-form");
|
||||
this.$timeInterval = $("#note-revision-snapshot-time-interval-in-seconds");
|
||||
|
||||
this.$form.submit(() => {
|
||||
const opts = { 'noteRevisionSnapshotTimeInterval': this.$timeInterval.val() };
|
||||
server.put('options', opts).then(() => infoService.showMessage("Options change have been saved."));
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
optionsLoaded(options) {
|
||||
this.$timeInterval.val(options['noteRevisionSnapshotTimeInterval']);
|
||||
}
|
||||
}
|
||||
54
src/public/javascripts/dialogs/options/other.js
Normal file
54
src/public/javascripts/dialogs/options/other.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import optionsService from "../../services/options.js";
|
||||
import server from "../../services/server.js";
|
||||
import toastService from "../../services/toast.js";
|
||||
|
||||
export default class ProtectedSessionOptions {
|
||||
constructor() {
|
||||
this.$spellCheckEnabled = $("#spell-check-enabled");
|
||||
this.$spellCheckLanguageCode = $("#spell-check-language-code");
|
||||
|
||||
this.$protectedSessionTimeout = $("#protected-session-timeout-in-seconds");
|
||||
this.$noteRevisionsTimeInterval = $("#note-revision-snapshot-time-interval-in-seconds");
|
||||
|
||||
this.$spellCheckEnabled.change(() => {
|
||||
const opts = { 'spellCheckEnabled': this.$spellCheckEnabled.is(":checked") ? "true" : "false" };
|
||||
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
this.$spellCheckLanguageCode.change(() => {
|
||||
const opts = { 'spellCheckLanguageCode': this.$spellCheckLanguageCode.val() };
|
||||
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
this.$protectedSessionTimeout.change(() => {
|
||||
const protectedSessionTimeout = this.$protectedSessionTimeout.val();
|
||||
|
||||
server.put('options', { 'protectedSessionTimeout': protectedSessionTimeout }).then(() => {
|
||||
optionsService.reloadOptions();
|
||||
|
||||
toastService.showMessage("Options change have been saved.");
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
this.$noteRevisionsTimeInterval.change(() => {
|
||||
const opts = { 'noteRevisionSnapshotTimeInterval': this.$noteRevisionsTimeInterval.val() };
|
||||
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
optionsLoaded(options) {
|
||||
this.$spellCheckEnabled.prop("checked", options['spellCheckEnabled'] === 'true');
|
||||
this.$spellCheckLanguageCode.val(options['spellCheckLanguageCode']);
|
||||
|
||||
this.$protectedSessionTimeout.val(options['protectedSessionTimeout']);
|
||||
this.$noteRevisionsTimeInterval.val(options['noteRevisionSnapshotTimeInterval']);
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
import optionsService from "../../services/options.js";
|
||||
import server from "../../services/server.js";
|
||||
import infoService from "../../services/info.js";
|
||||
|
||||
export default class ProtectedSessionOptions {
|
||||
constructor() {
|
||||
this.$form = $("#protected-session-timeout-form");
|
||||
this.$protectedSessionTimeout = $("#protected-session-timeout-in-seconds");
|
||||
|
||||
this.$form.submit(() => this.save());
|
||||
}
|
||||
|
||||
optionsLoaded(options) {
|
||||
this.$protectedSessionTimeout.val(options['protectedSessionTimeout']);
|
||||
}
|
||||
|
||||
save() {
|
||||
const protectedSessionTimeout = this.$protectedSessionTimeout.val();
|
||||
|
||||
server.put('options', { 'protectedSessionTimeout': protectedSessionTimeout }).then(() => {
|
||||
optionsService.reloadOptions();
|
||||
|
||||
infoService.showMessage("Options change have been saved.");
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import server from "../../services/server.js";
|
||||
import infoService from "../../services/info.js";
|
||||
import toastService from "../../services/toast.js";
|
||||
|
||||
export default class SyncOptions {
|
||||
constructor() {
|
||||
@@ -15,10 +15,10 @@ export default class SyncOptions {
|
||||
const result = await server.post('sync/test');
|
||||
|
||||
if (result.success) {
|
||||
infoService.showMessage(result.message);
|
||||
toastService.showMessage(result.message);
|
||||
}
|
||||
else {
|
||||
infoService.showError("Sync server handshake failed, error: " + result.message);
|
||||
toastService.showError("Sync server handshake failed, error: " + result.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -36,7 +36,7 @@ export default class SyncOptions {
|
||||
'syncProxy': this.$syncProxy.val()
|
||||
};
|
||||
|
||||
server.put('options', opts).then(() => infoService.showMessage("Options change have been saved."));
|
||||
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import libraryLoader from '../services/library_loader.js';
|
||||
import server from '../services/server.js';
|
||||
import infoService from "../services/info.js";
|
||||
import toastService from "../services/toast.js";
|
||||
import utils from "../services/utils.js";
|
||||
|
||||
const $dialog = $("#sql-console-dialog");
|
||||
@@ -63,11 +63,11 @@ async function execute() {
|
||||
});
|
||||
|
||||
if (!result.success) {
|
||||
infoService.showError(result.error);
|
||||
toastService.showError(result.error);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
infoService.showMessage("Query was executed successfully.");
|
||||
toastService.showMessage("Query was executed successfully.");
|
||||
}
|
||||
|
||||
const rows = result.rows;
|
||||
|
||||
@@ -4,8 +4,8 @@ import NoteShort from './note_short.js';
|
||||
* Represents full note, specifically including note's content.
|
||||
*/
|
||||
class NoteFull extends NoteShort {
|
||||
constructor(treeCache, row) {
|
||||
super(treeCache, row);
|
||||
constructor(treeCache, row, noteShort) {
|
||||
super(treeCache, row, []);
|
||||
|
||||
/** @param {string} */
|
||||
this.content = row.content;
|
||||
@@ -21,6 +21,12 @@ class NoteFull extends NoteShort {
|
||||
|
||||
/** @param {string} */
|
||||
this.utcDateModified = row.utcDateModified;
|
||||
|
||||
/* ugly */
|
||||
this.parents = noteShort.parents;
|
||||
this.parentToBranch = noteShort.parentToBranch;
|
||||
this.children = noteShort.children;
|
||||
this.childToBranch = noteShort.childToBranch;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import server from '../services/server.js';
|
||||
import Attribute from './attribute.js';
|
||||
import branches from "../services/branches.js";
|
||||
|
||||
const LABEL = 'label';
|
||||
const LABEL_DEFINITION = 'label-definition';
|
||||
@@ -13,7 +14,12 @@ const RELATION_DEFINITION = 'relation-definition';
|
||||
* This note's representation is used in note tree and is kept in TreeCache.
|
||||
*/
|
||||
class NoteShort {
|
||||
constructor(treeCache, row) {
|
||||
/**
|
||||
* @param {TreeCache} treeCache
|
||||
* @param {Object.<string, Object>} row
|
||||
* @param {Branch[]} branches - all relevant branches, i.e. where this note is either child or parent
|
||||
*/
|
||||
constructor(treeCache, row, branches) {
|
||||
this.treeCache = treeCache;
|
||||
/** @param {string} */
|
||||
this.noteId = row.noteId;
|
||||
@@ -26,9 +32,60 @@ class NoteShort {
|
||||
/** @param {string} content-type, e.g. "application/json" */
|
||||
this.mime = row.mime;
|
||||
/** @param {boolean} */
|
||||
this.isDeleted = row.isDeleted;
|
||||
/** @param {boolean} */
|
||||
this.archived = row.archived;
|
||||
/** @param {string} */
|
||||
this.cssClass = row.cssClass;
|
||||
|
||||
/** @type {string[]} */
|
||||
this.parents = [];
|
||||
/** @type {string[]} */
|
||||
this.children = [];
|
||||
|
||||
/** @type {Object.<string, string>} */
|
||||
this.parentToBranch = {};
|
||||
|
||||
/** @type {Object.<string, string>} */
|
||||
this.childToBranch = {};
|
||||
|
||||
for (const branch of branches) {
|
||||
if (this.noteId === branch.noteId) {
|
||||
this.parents.push(branch.parentNoteId);
|
||||
this.parentToBranch[branch.parentNoteId] = branch.branchId;
|
||||
}
|
||||
else if (this.noteId === branch.parentNoteId) {
|
||||
this.children.push(branch.noteId);
|
||||
this.childToBranch[branch.noteId] = branch.branchId;
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unknown branch ${branch.branchId} for note ${this.noteId}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addParent(parentNoteId, branchId) {
|
||||
if (!this.parents.includes(parentNoteId)) {
|
||||
this.parents.push(parentNoteId);
|
||||
}
|
||||
|
||||
this.parentToBranch[parentNoteId] = branchId;
|
||||
}
|
||||
|
||||
addChild(childNoteId, branchId) {
|
||||
if (!this.children.includes(childNoteId)) {
|
||||
this.children.push(childNoteId);
|
||||
}
|
||||
|
||||
this.childToBranch[childNoteId] = branchId;
|
||||
|
||||
const branchIdPos = {};
|
||||
|
||||
for (const branchId of Object.values(this.childToBranch)) {
|
||||
branchIdPos[branchId] = this.treeCache.getBranch(branchId).notePosition;
|
||||
}
|
||||
|
||||
this.children.sort((a, b) => branchIdPos[this.childToBranch[a]] < branchIdPos[this.childToBranch[b]] ? -1 : 1);
|
||||
}
|
||||
|
||||
/** @returns {boolean} */
|
||||
@@ -58,48 +115,42 @@ class NoteShort {
|
||||
|
||||
/** @returns {Promise<Branch[]>} */
|
||||
async getBranches() {
|
||||
const branchIds = this.treeCache.parents[this.noteId].map(
|
||||
parentNoteId => this.treeCache.getBranchIdByChildParent(this.noteId, parentNoteId));
|
||||
const branchIds = Object.values(this.parentToBranch);
|
||||
|
||||
return this.treeCache.getBranches(branchIds);
|
||||
}
|
||||
|
||||
/** @returns {boolean} */
|
||||
hasChildren() {
|
||||
return this.treeCache.children[this.noteId]
|
||||
&& this.treeCache.children[this.noteId].length > 0;
|
||||
return this.children.length > 0;
|
||||
}
|
||||
|
||||
/** @returns {Promise<Branch[]>} */
|
||||
async getChildBranches() {
|
||||
if (!this.treeCache.children[this.noteId]) {
|
||||
return [];
|
||||
}
|
||||
// don't use Object.values() to guarantee order
|
||||
const branchIds = this.children.map(childNoteId => this.childToBranch[childNoteId]);
|
||||
|
||||
const branchIds = this.treeCache.children[this.noteId].map(
|
||||
childNoteId => this.treeCache.getBranchIdByChildParent(childNoteId, this.noteId));
|
||||
|
||||
return await this.treeCache.getBranches(branchIds);
|
||||
return this.treeCache.getBranches(branchIds);
|
||||
}
|
||||
|
||||
/** @returns {string[]} */
|
||||
getParentNoteIds() {
|
||||
return this.treeCache.parents[this.noteId] || [];
|
||||
return this.parents;
|
||||
}
|
||||
|
||||
/** @returns {Promise<NoteShort[]>} */
|
||||
async getParentNotes() {
|
||||
return await this.treeCache.getNotes(this.getParentNoteIds());
|
||||
return await this.treeCache.getNotes(this.parents);
|
||||
}
|
||||
|
||||
/** @returns {string[]} */
|
||||
getChildNoteIds() {
|
||||
return this.treeCache.children[this.noteId] || [];
|
||||
return this.children;
|
||||
}
|
||||
|
||||
/** @returns {Promise<NoteShort[]>} */
|
||||
async getChildNotes() {
|
||||
return await this.treeCache.getNotes(this.getChildNoteIds());
|
||||
return await this.treeCache.getNotes(this.children);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -91,7 +91,7 @@ async function showTree() {
|
||||
|
||||
$detail.on("click", ".note-menu-button", async e => {
|
||||
const node = treeService.getActiveNode();
|
||||
const branch = await treeCache.getBranch(node.data.branchId);
|
||||
const branch = treeCache.getBranch(node.data.branchId);
|
||||
const note = await treeCache.getNote(node.data.noteId);
|
||||
const parentNote = await treeCache.getNote(branch.parentNoteId);
|
||||
const isNotRoot = note.noteId !== 'root';
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import treeService from './tree.js';
|
||||
import utils from './utils.js';
|
||||
import server from './server.js';
|
||||
import infoService from "./info.js";
|
||||
import toastService from "./toast.js";
|
||||
import treeCache from "./tree_cache.js";
|
||||
import treeUtils from "./tree_utils.js";
|
||||
import hoistedNoteService from "./hoisted_note.js";
|
||||
import noteDetailService from "./note_detail.js";
|
||||
import ws from "./ws.js";
|
||||
|
||||
async function moveBeforeNode(nodesToMove, beforeNode) {
|
||||
nodesToMove = await filterRootNote(nodesToMove);
|
||||
@@ -79,6 +80,22 @@ async function moveToNode(nodesToMove, toNode) {
|
||||
}
|
||||
}
|
||||
|
||||
async function getNextNode(nodes) {
|
||||
// following code assumes that nodes contain only top-most selected nodes - getSelectedNodes has been
|
||||
// called with stopOnParent=true
|
||||
let next = nodes[nodes.length - 1].getNextSibling();
|
||||
|
||||
if (!next) {
|
||||
next = nodes[0].getPrevSibling();
|
||||
}
|
||||
|
||||
if (!next && !await hoistedNoteService.isRootNode(nodes[0])) {
|
||||
next = nodes[0].getParent();
|
||||
}
|
||||
|
||||
return treeUtils.getNotePath(next);
|
||||
}
|
||||
|
||||
async function deleteNodes(nodes) {
|
||||
nodes = await filterRootNote(nodes);
|
||||
|
||||
@@ -105,14 +122,23 @@ async function deleteNodes(nodes) {
|
||||
|
||||
const deleteClones = $deleteClonesCheckbox.find("input").is(":checked");
|
||||
|
||||
const taskId = utils.randomString(10);
|
||||
|
||||
let counter = 0;
|
||||
|
||||
for (const node of nodes) {
|
||||
counter++;
|
||||
|
||||
const last = counter === nodes.length;
|
||||
const query = `?taskId=${taskId}&last=${last ? 'true' : 'false'}`;
|
||||
|
||||
if (deleteClones) {
|
||||
await server.remove('notes/' + node.data.noteId);
|
||||
await server.remove(`notes/${node.data.noteId}` + query);
|
||||
|
||||
noteDetailService.noteDeleted(node.data.noteId);
|
||||
}
|
||||
else {
|
||||
const {noteDeleted} = await server.remove('branches/' + node.data.branchId);
|
||||
const {noteDeleted} = await server.remove(`branches/${node.data.branchId}` + query);
|
||||
|
||||
if (noteDeleted) {
|
||||
noteDetailService.noteDeleted(node.data.noteId);
|
||||
@@ -120,51 +146,11 @@ async function deleteNodes(nodes) {
|
||||
}
|
||||
}
|
||||
|
||||
if (deleteClones) {
|
||||
// if clones are also deleted we give up with targeted cleanup of the tree
|
||||
treeService.reload();
|
||||
return true;
|
||||
}
|
||||
const nextNotePath = await getNextNode(nodes);
|
||||
|
||||
// following code assumes that nodes contain only top-most selected nodes - getSelectedNodes has been
|
||||
// called with stopOnParent=true
|
||||
let next = nodes[nodes.length - 1].getNextSibling();
|
||||
const noteIds = Array.from(new Set(nodes.map(node => node.data.noteId)));
|
||||
|
||||
if (!next) {
|
||||
next = nodes[0].getPrevSibling();
|
||||
}
|
||||
|
||||
if (!next && !await hoistedNoteService.isRootNode(nodes[0])) {
|
||||
next = nodes[0].getParent();
|
||||
}
|
||||
|
||||
let activeNotePath = null;
|
||||
|
||||
if (next) {
|
||||
activeNotePath = await treeUtils.getNotePath(next);
|
||||
}
|
||||
|
||||
await treeService.loadTreeCache();
|
||||
|
||||
const parentNoteIds = Array.from(new Set(nodes.map(node => node.getParent().data.noteId)));
|
||||
|
||||
for (const node of nodes) {
|
||||
node.remove();
|
||||
}
|
||||
|
||||
for (const parentNoteId of parentNoteIds) {
|
||||
await treeService.reloadNote(parentNoteId);
|
||||
}
|
||||
|
||||
// activate after all the reloading
|
||||
if (activeNotePath) {
|
||||
treeService.focusTree();
|
||||
|
||||
const node = await treeService.activateNote(activeNotePath);
|
||||
node.setFocus(true);
|
||||
}
|
||||
|
||||
infoService.showMessage("Note(s) has been deleted.");
|
||||
await treeService.reloadNotes(noteIds, nextNotePath);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -208,7 +194,7 @@ async function changeNode(func, node, beforeNoteId = null, afterNoteId = null) {
|
||||
|
||||
node.data.parentNoteId = thisNewParentNode.data.noteId;
|
||||
|
||||
await treeCache.moveNote(childNoteId, thisOldParentNode.data.noteId, thisNewParentNode.data.noteId, beforeNoteId, afterNoteId);
|
||||
await treeCache.reloadNotes([childNoteId]);
|
||||
|
||||
await treeService.checkFolderStatus(thisOldParentNode);
|
||||
await treeService.checkFolderStatus(thisNewParentNode);
|
||||
@@ -249,6 +235,33 @@ async function filterRootNote(nodes) {
|
||||
&& node.data.noteId !== hoistedNoteId);
|
||||
}
|
||||
|
||||
function makeToast(id, message) {
|
||||
return {
|
||||
id: id,
|
||||
title: "Delete status",
|
||||
message: message,
|
||||
icon: "trash"
|
||||
};
|
||||
}
|
||||
|
||||
ws.subscribeToMessages(async message => {
|
||||
if (message.taskType !== 'delete-notes') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.type === 'task-error') {
|
||||
toastService.closePersistent(message.taskId);
|
||||
toastService.showError(message.message);
|
||||
} else if (message.type === 'task-progress-count') {
|
||||
toastService.showPersistent(makeToast(message.taskId, "Delete notes in progress: " + message.progressCount));
|
||||
} else if (message.type === 'task-succeeded') {
|
||||
const toast = makeToast(message.taskId, "Delete finished successfully.");
|
||||
toast.closeAfter = 5000;
|
||||
|
||||
toastService.showPersistent(toast);
|
||||
}
|
||||
});
|
||||
|
||||
export default {
|
||||
moveBeforeNode,
|
||||
moveAfterNode,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import ScriptContext from "./script_context.js";
|
||||
import server from "./server.js";
|
||||
import infoService from "./info.js";
|
||||
import toastService from "./toast.js";
|
||||
|
||||
async function getAndExecuteBundle(noteId, originEntity = null) {
|
||||
const bundle = await server.get('script/bundle/' + noteId);
|
||||
@@ -8,8 +8,8 @@ async function getAndExecuteBundle(noteId, originEntity = null) {
|
||||
return await executeBundle(bundle, originEntity);
|
||||
}
|
||||
|
||||
async function executeBundle(bundle, originEntity, tabContext) {
|
||||
const apiContext = await ScriptContext(bundle.noteId, bundle.allNoteIds, originEntity, tabContext);
|
||||
async function executeBundle(bundle, originEntity, tabContext, $container) {
|
||||
const apiContext = await ScriptContext(bundle.noteId, bundle.allNoteIds, originEntity, tabContext, $container);
|
||||
|
||||
try {
|
||||
return await (function () {
|
||||
@@ -17,7 +17,7 @@ async function executeBundle(bundle, originEntity, tabContext) {
|
||||
}.call(apiContext));
|
||||
}
|
||||
catch (e) {
|
||||
infoService.showAndLogError(`Execution of ${bundle.noteId} failed with error: ${e.message}`);
|
||||
toastService.showAndLogError(`Execution of ${bundle.noteId} failed with error: ${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import treeUtils from "./tree_utils.js";
|
||||
import treeChangesService from "./branches.js";
|
||||
import cloningService from "./cloning.js";
|
||||
import infoService from "./info.js";
|
||||
import toastService from "./toast.js";
|
||||
|
||||
let clipboardIds = [];
|
||||
let clipboardMode = null;
|
||||
@@ -26,7 +26,7 @@ async function pasteAfter(node) {
|
||||
// just do nothing
|
||||
}
|
||||
else {
|
||||
infoService.throwError("Unrecognized clipboard mode=" + clipboardMode);
|
||||
toastService.throwError("Unrecognized clipboard mode=" + clipboardMode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ async function pasteInto(node) {
|
||||
// just do nothing
|
||||
}
|
||||
else {
|
||||
infoService.throwError("Unrecognized clipboard mode=" + mode);
|
||||
toastService.throwError("Unrecognized clipboard mode=" + mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,14 +62,14 @@ function copy(nodes) {
|
||||
clipboardIds = nodes.map(node => node.data.noteId);
|
||||
clipboardMode = 'copy';
|
||||
|
||||
infoService.showMessage("Note(s) have been copied into clipboard.");
|
||||
toastService.showMessage("Note(s) have been copied into clipboard.");
|
||||
}
|
||||
|
||||
function cut(nodes) {
|
||||
clipboardIds = nodes.map(node => node.key);
|
||||
clipboardMode = 'cut';
|
||||
|
||||
infoService.showMessage("Note(s) have been cut into clipboard.");
|
||||
toastService.showMessage("Note(s) have been cut into clipboard.");
|
||||
}
|
||||
|
||||
function isEmpty() {
|
||||
|
||||
@@ -12,9 +12,7 @@ async function cloneNoteTo(childNoteId, parentNoteId, prefix) {
|
||||
return;
|
||||
}
|
||||
|
||||
treeCache.addBranchRelationship(resp.branchId, childNoteId, parentNoteId);
|
||||
|
||||
await treeService.reloadNote(parentNoteId);
|
||||
await treeService.reloadNotes([childNoteId, parentNoteId]);
|
||||
}
|
||||
|
||||
// beware that first arg is noteId and second is branchId!
|
||||
@@ -26,11 +24,9 @@ async function cloneNoteAfter(noteId, afterBranchId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const afterBranch = await treeCache.getBranch(afterBranchId);
|
||||
const afterBranch = treeCache.getBranch(afterBranchId);
|
||||
|
||||
treeCache.addBranchRelationship(resp.branchId, noteId, afterBranch.parentNoteId);
|
||||
|
||||
await treeService.reloadNote(afterBranch.parentNoteId);
|
||||
await treeService.reloadNotes([noteId, afterBranch.parentNoteId]);
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
@@ -8,27 +8,21 @@ async function getTodayNote() {
|
||||
|
||||
/** @return {NoteShort} */
|
||||
async function getDateNote(date) {
|
||||
const note = await server.get('date-notes/date/' + date);
|
||||
|
||||
await treeCache.reloadParents(note.noteId);
|
||||
const note = await server.get('date-notes/date/' + date, {'trilium-source-id': "date-note"});
|
||||
|
||||
return await treeCache.getNote(note.noteId);
|
||||
}
|
||||
|
||||
/** @return {NoteShort} */
|
||||
async function getMonthNote(month) {
|
||||
const note = await server.get('date-notes/month/' + month);
|
||||
|
||||
await treeCache.reloadParents(note.noteId);
|
||||
const note = await server.get('date-notes/month/' + month, {'trilium-source-id': "date-note"});
|
||||
|
||||
return await treeCache.getNote(note.noteId);
|
||||
}
|
||||
|
||||
/** @return {NoteShort} */
|
||||
async function getYearNote(year) {
|
||||
const note = await server.get('date-notes/year/' + year);
|
||||
|
||||
await treeCache.reloadParents(note.noteId);
|
||||
const note = await server.get('date-notes/year/' + year, {'trilium-source-id': "date-note"});
|
||||
|
||||
return await treeCache.getNote(note.noteId);
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ const dragAndDropSetup = {
|
||||
if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
|
||||
const files = [...dataTransfer.files]; // chrome has issue that dataTransfer.files empties after async operation
|
||||
|
||||
const importDialog = await import('../dialogs/import.js');
|
||||
const importService = await import('./import.js');
|
||||
|
||||
importDialog.uploadFiles(node.data.noteId, files, {
|
||||
importService.uploadFiles(node.data.noteId, files, {
|
||||
safeImport: true,
|
||||
shrinkImages: true,
|
||||
textImportedAsText: true,
|
||||
|
||||
@@ -172,6 +172,19 @@ function registerEntrypoints() {
|
||||
utils.bindGlobalShortcut('ctrl+-', zoomService.decreaseZoomFactor);
|
||||
utils.bindGlobalShortcut('ctrl+=', zoomService.increaseZoomFactor);
|
||||
}
|
||||
|
||||
$(document).on('click', "a[data-action='note-revision']", async event => {
|
||||
const linkEl = $(event.target);
|
||||
const noteId = linkEl.attr('data-note-path');
|
||||
const noteRevisionId = linkEl.attr('data-note-revision-id');
|
||||
|
||||
const attributesDialog = await import("../dialogs/note_revisions.js");
|
||||
|
||||
attributesDialog.showNoteRevisionsDialog(noteId, noteRevisionId);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import treeService from './tree.js';
|
||||
import server from './server.js';
|
||||
import utils from './utils.js';
|
||||
import infoService from './info.js';
|
||||
import toastService from './toast.js';
|
||||
import linkService from './link.js';
|
||||
import treeCache from './tree_cache.js';
|
||||
import noteDetailService from './note_detail.js';
|
||||
@@ -9,6 +9,8 @@ import noteTooltipService from './note_tooltip.js';
|
||||
import protectedSessionService from './protected_session.js';
|
||||
import dateNotesService from './date_notes.js';
|
||||
import StandardWidget from '../widgets/standard_widget.js';
|
||||
import ws from "./ws.js";
|
||||
import hoistedNoteService from "./hoisted_note.js";
|
||||
|
||||
/**
|
||||
* This is the main frontend API interface for scripts. It's published in the local "api" object.
|
||||
@@ -16,9 +18,12 @@ import StandardWidget from '../widgets/standard_widget.js';
|
||||
* @constructor
|
||||
* @hideconstructor
|
||||
*/
|
||||
function FrontendScriptApi(startNote, currentNote, originEntity = null, tabContext = null) {
|
||||
function FrontendScriptApi(startNote, currentNote, originEntity = null, tabContext = null, $container = null) {
|
||||
const $pluginButtons = $("#plugin-buttons");
|
||||
|
||||
/** @property {jQuery} container of all the rendered script content */
|
||||
this.$container = $container;
|
||||
|
||||
/** @property {object} note where script started executing */
|
||||
this.startNote = startNote;
|
||||
/** @property {object} note where script is currently executing */
|
||||
@@ -139,9 +144,14 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
currentNoteId: currentNote.noteId,
|
||||
originEntityName: "notes", // currently there's no other entity on frontend which can trigger event
|
||||
originEntityId: originEntity ? originEntity.noteId : null
|
||||
}, {
|
||||
'trilium-source-id': "script"
|
||||
});
|
||||
|
||||
if (ret.success) {
|
||||
// wait until all the changes done in the script has been synced to frontend before continuing
|
||||
await ws.waitForSyncId(ret.maxSyncId);
|
||||
|
||||
return ret.executionResult;
|
||||
}
|
||||
else {
|
||||
@@ -202,16 +212,12 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
this.getNotes = async (noteIds, silentNotFoundError = false) => await treeCache.getNotes(noteIds, silentNotFoundError);
|
||||
|
||||
/**
|
||||
* @param {string} noteId
|
||||
* Update frontend tree (note) cache from the backend.
|
||||
*
|
||||
* @param {string[]} noteIds
|
||||
* @method
|
||||
*/
|
||||
this.reloadChildren = async noteId => await treeCache.reloadChildren(noteId);
|
||||
|
||||
/**
|
||||
* @param {string} noteId
|
||||
* @method
|
||||
*/
|
||||
this.reloadParents = async noteId => await treeCache.reloadParents(noteId);
|
||||
this.reloadNotes = async noteIds => await treeCache.reloadNotes(noteIds);
|
||||
|
||||
/**
|
||||
* Instance name identifies particular Trilium instance. It can be useful for scripts
|
||||
@@ -241,7 +247,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
* @method
|
||||
* @param {string} message
|
||||
*/
|
||||
this.showMessage = infoService.showMessage;
|
||||
this.showMessage = toastService.showMessage;
|
||||
|
||||
/**
|
||||
* Show error message to the user.
|
||||
@@ -249,7 +255,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
* @method
|
||||
* @param {string} message
|
||||
*/
|
||||
this.showError = infoService.showError;
|
||||
this.showError = toastService.showError;
|
||||
|
||||
/**
|
||||
* Refresh tree
|
||||
@@ -272,17 +278,13 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
* @method
|
||||
* @returns {NoteFull} active note (loaded into right pane)
|
||||
*/
|
||||
this.getActiveNote = noteDetailService.getActiveNote;
|
||||
this.getActiveTabNote = noteDetailService.getActiveTabNote;
|
||||
|
||||
/**
|
||||
* @method
|
||||
* @returns {Promise<string|null>} returns note path of active note or null if there isn't active note
|
||||
*/
|
||||
this.getActiveNotePath = () => {
|
||||
const activeTabContext = noteDetailService.getActiveTabContext();
|
||||
|
||||
return activeTabContext ? activeTabContext.notePath : null;
|
||||
};
|
||||
this.getActiveTabNotePath = noteDetailService.getActiveTabNotePath;
|
||||
|
||||
/**
|
||||
* This method checks whether user navigated away from the note from which the scripts has been started.
|
||||
@@ -348,6 +350,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
|
||||
* @return {Promise<NoteShort>}
|
||||
*/
|
||||
this.getYearNote = dateNotesService.getYearNote;
|
||||
|
||||
/**
|
||||
* Hoist note. See https://github.com/zadam/trilium/wiki/Note-hoisting
|
||||
*
|
||||
* @method
|
||||
* @param {string} noteId - set hoisted note. 'root' will effectively unhoist
|
||||
* @return {Promise}
|
||||
*/
|
||||
this.setHoistedNoteId = hoistedNoteService.setHoistedNoteId;
|
||||
}
|
||||
|
||||
export default FrontendScriptApi;
|
||||
78
src/public/javascripts/services/import.js
Normal file
78
src/public/javascripts/services/import.js
Normal file
@@ -0,0 +1,78 @@
|
||||
import toastService from "./toast.js";
|
||||
import treeService from "./tree.js";
|
||||
import server from "./server.js";
|
||||
import ws from "./ws.js";
|
||||
import utils from "./utils.js";
|
||||
|
||||
export async function uploadFiles(parentNoteId, files, options) {
|
||||
if (files.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const taskId = utils.randomString(10);
|
||||
let noteId;
|
||||
let counter = 0;
|
||||
|
||||
for (const file of files) {
|
||||
counter++;
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('upload', file);
|
||||
formData.append('taskId', taskId);
|
||||
formData.append('last', counter === files.length ? "true" : "false");
|
||||
|
||||
for (const key in options) {
|
||||
formData.append(key, options[key]);
|
||||
}
|
||||
|
||||
({noteId} = await $.ajax({
|
||||
url: baseApiUrl + 'notes/' + parentNoteId + '/import',
|
||||
headers: server.getHeaders(),
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
timeout: 60 * 60 * 1000,
|
||||
contentType: false, // NEEDED, DON'T REMOVE THIS
|
||||
processData: false, // NEEDED, DON'T REMOVE THIS
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
function makeToast(id, message) {
|
||||
return {
|
||||
id: id,
|
||||
title: "Import status",
|
||||
message: message,
|
||||
icon: "plus"
|
||||
};
|
||||
}
|
||||
|
||||
ws.subscribeToMessages(async message => {
|
||||
if (message.taskType !== 'import') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.type === 'task-error') {
|
||||
toastService.closePersistent(message.taskId);
|
||||
toastService.showError(message.message);
|
||||
} else if (message.type === 'task-progress-count') {
|
||||
toastService.showPersistent(makeToast(message.taskId, "Import in progress: " + message.progressCount));
|
||||
} else if (message.type === 'task-succeeded') {
|
||||
const toast = makeToast(message.taskId, "Import finished successfully.");
|
||||
toast.closeAfter = 5000;
|
||||
|
||||
toastService.showPersistent(toast);
|
||||
|
||||
await treeService.reloadNotes([message.parentNoteId]);
|
||||
|
||||
if (message.result.importedNoteId) {
|
||||
const node = await treeService.activateNote(message.result.importedNoteId);
|
||||
|
||||
node.setExpanded(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default {
|
||||
uploadFiles
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
import ws from "./ws.js";
|
||||
import utils from "./utils.js";
|
||||
|
||||
function showMessage(message) {
|
||||
console.debug(utils.now(), "message: ", message);
|
||||
|
||||
$.notify({
|
||||
icon: 'jam jam-check',
|
||||
message: message
|
||||
}, getNotifySettings('success', 3000));
|
||||
}
|
||||
|
||||
function showAndLogError(message, delay = 10000) {
|
||||
showError(message, delay);
|
||||
|
||||
ws.logError(message);
|
||||
}
|
||||
|
||||
function showError(message, delay = 10000) {
|
||||
console.log(utils.now(), "error: ", message);
|
||||
|
||||
$.notify({
|
||||
// options
|
||||
icon: 'jam jam-alert',
|
||||
message: message
|
||||
}, getNotifySettings('danger', delay));
|
||||
}
|
||||
|
||||
function getNotifySettings(type, delay) {
|
||||
return {
|
||||
element: 'body',
|
||||
type: type,
|
||||
z_index: 90000,
|
||||
placement: {
|
||||
from: "top",
|
||||
align: "center"
|
||||
},
|
||||
animate: {
|
||||
enter: 'animated fadeInDown',
|
||||
exit: 'animated fadeOutUp'
|
||||
},
|
||||
delay: delay
|
||||
};
|
||||
}
|
||||
|
||||
function throwError(message) {
|
||||
ws.logError(message);
|
||||
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
export default {
|
||||
showMessage,
|
||||
showError,
|
||||
showAndLogError,
|
||||
throwError
|
||||
}
|
||||
@@ -14,20 +14,24 @@ function getNotePathFromUrl(url) {
|
||||
}
|
||||
}
|
||||
|
||||
async function createNoteLink(notePath, noteTitle = null) {
|
||||
async function createNoteLink(notePath, noteTitle = null, tooltip = true) {
|
||||
if (!noteTitle) {
|
||||
const noteId = treeUtils.getNoteIdFromNotePath(notePath);
|
||||
|
||||
noteTitle = await treeUtils.getNoteTitle(noteId);
|
||||
}
|
||||
|
||||
const noteLink = $("<a>", {
|
||||
const $noteLink = $("<a>", {
|
||||
href: 'javascript:',
|
||||
text: noteTitle
|
||||
}).attr('data-action', 'note')
|
||||
.attr('data-note-path', notePath);
|
||||
|
||||
return noteLink;
|
||||
if (!tooltip) {
|
||||
$noteLink.addClass("no-tooltip-preview");
|
||||
}
|
||||
|
||||
return $noteLink;
|
||||
}
|
||||
|
||||
async function createNoteLinkWithPath(notePath, noteTitle = null) {
|
||||
@@ -113,7 +117,7 @@ function addTextToEditor(text) {
|
||||
}
|
||||
}
|
||||
|
||||
function tabContextMenu(e) {
|
||||
function newTabContextMenu(e) {
|
||||
const $link = $(e.target);
|
||||
|
||||
const notePath = getNotePathFromLink($link);
|
||||
@@ -138,9 +142,9 @@ function tabContextMenu(e) {
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('contextmenu', '.note-detail-text a', tabContextMenu);
|
||||
$(document).on('contextmenu', "a[data-action='note']", tabContextMenu);
|
||||
$(document).on('contextmenu', ".note-detail-render a", tabContextMenu);
|
||||
$(document).on('contextmenu', '.note-detail-text a', newTabContextMenu);
|
||||
$(document).on('contextmenu', "a[data-action='note']", newTabContextMenu);
|
||||
$(document).on('contextmenu', ".note-detail-render a", newTabContextMenu);
|
||||
|
||||
// when click on link popup, in case of internal link, just go the the referenced note instead of default behavior
|
||||
// of opening the link in new window/tab
|
||||
@@ -159,6 +163,7 @@ $(document).on('mousedown', '.note-detail-text a', function (e) {
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('mousedown', '.note-detail-book a', goToLink);
|
||||
$(document).on('mousedown', '.note-detail-render a', goToLink);
|
||||
$(document).on('mousedown', '.note-detail-text.ck-read-only a', goToLink);
|
||||
$(document).on('mousedown', 'span.ck-button__label', e => {
|
||||
|
||||
@@ -8,7 +8,7 @@ const SELECTED_PATH_KEY = "data-note-path";
|
||||
async function autocompleteSource(term, cb) {
|
||||
const result = await server.get('autocomplete'
|
||||
+ '?query=' + encodeURIComponent(term)
|
||||
+ '&activeNoteId=' + noteDetailService.getActiveNoteId());
|
||||
+ '&activeNoteId=' + noteDetailService.getActiveTabNoteId());
|
||||
|
||||
if (result.length === 0) {
|
||||
result.push({
|
||||
|
||||
@@ -90,6 +90,7 @@ async function activateOrOpenNote(noteId) {
|
||||
});
|
||||
}
|
||||
|
||||
/** @return {TabContext[]} */
|
||||
function getTabContexts() {
|
||||
return tabContexts;
|
||||
}
|
||||
@@ -107,20 +108,28 @@ function getActiveTabContext() {
|
||||
return tabContexts.find(tc => tc.tabId === tabId);
|
||||
}
|
||||
|
||||
/** @returns {string|null} */
|
||||
function getActiveTabNotePath() {
|
||||
const activeContext = getActiveTabContext();
|
||||
return activeContext ? activeContext.notePath : null;
|
||||
}
|
||||
|
||||
/** @return {NoteFull} */
|
||||
function getActiveNote() {
|
||||
function getActiveTabNote() {
|
||||
const activeContext = getActiveTabContext();
|
||||
return activeContext ? activeContext.note : null;
|
||||
}
|
||||
|
||||
function getActiveNoteId() {
|
||||
const activeNote = getActiveNote();
|
||||
/** @return {string|null} */
|
||||
function getActiveTabNoteId() {
|
||||
const activeNote = getActiveTabNote();
|
||||
|
||||
return activeNote ? activeNote.noteId : null;
|
||||
}
|
||||
|
||||
function getActiveNoteType() {
|
||||
const activeNote = getActiveNote();
|
||||
/** @return {string|null} */
|
||||
function getActiveTabNoteType() {
|
||||
const activeNote = getActiveTabNote();
|
||||
|
||||
return activeNote ? activeNote.type : null;
|
||||
}
|
||||
@@ -241,7 +250,9 @@ async function loadNoteDetail(origNotePath, options = {}) {
|
||||
async function loadNote(noteId) {
|
||||
const row = await server.get('notes/' + noteId);
|
||||
|
||||
return new NoteFull(treeCache, row);
|
||||
const noteShort = await treeCache.getNote(noteId);
|
||||
|
||||
return new NoteFull(treeCache, row, noteShort);
|
||||
}
|
||||
|
||||
async function filterTabs(noteId) {
|
||||
@@ -300,7 +311,7 @@ function addDetailLoadedListener(noteId, callback) {
|
||||
|
||||
function fireDetailLoaded() {
|
||||
for (const {noteId, callback} of detailLoadedListeners) {
|
||||
if (noteId === getActiveNoteId()) {
|
||||
if (noteId === getActiveTabNoteId()) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
@@ -337,7 +348,7 @@ $tabContentsContainer.on("dragover", e => e.preventDefault());
|
||||
$tabContentsContainer.on("dragleave", e => e.preventDefault());
|
||||
|
||||
$tabContentsContainer.on("drop", async e => {
|
||||
const activeNote = getActiveNote();
|
||||
const activeNote = getActiveTabNote();
|
||||
|
||||
if (!activeNote) {
|
||||
return;
|
||||
@@ -345,9 +356,9 @@ $tabContentsContainer.on("drop", async e => {
|
||||
|
||||
const files = [...e.originalEvent.dataTransfer.files]; // chrome has issue that dataTransfer.files empties after async operation
|
||||
|
||||
const importDialog = await import("../dialogs/import.js");
|
||||
const importService = await import("./import.js");
|
||||
|
||||
importDialog.uploadFiles(activeNote.noteId, files, {
|
||||
importService.uploadFiles(activeNote.noteId, files, {
|
||||
safeImport: true,
|
||||
shrinkImages: true,
|
||||
textImportedAsText: true,
|
||||
@@ -385,6 +396,8 @@ tabRow.addListener('tabRemove', async ({ detail }) => {
|
||||
});
|
||||
|
||||
$(tabRow.el).on('contextmenu', '.note-tab', e => {
|
||||
e.preventDefault();
|
||||
|
||||
const tab = $(e.target).closest(".note-tab");
|
||||
|
||||
contextMenuService.initContextMenu(e, {
|
||||
@@ -495,9 +508,6 @@ export default {
|
||||
switchToNote,
|
||||
loadNote,
|
||||
loadNoteDetail,
|
||||
getActiveNote,
|
||||
getActiveNoteType,
|
||||
getActiveNoteId,
|
||||
focusOnTitle,
|
||||
focusAndSelectTitle,
|
||||
saveNotesIfChanged,
|
||||
@@ -506,6 +516,10 @@ export default {
|
||||
switchToTab,
|
||||
getTabContexts,
|
||||
getActiveTabContext,
|
||||
getActiveTabNotePath,
|
||||
getActiveTabNote,
|
||||
getActiveTabNoteType,
|
||||
getActiveTabNoteId,
|
||||
getActiveEditor,
|
||||
activateOrOpenNote,
|
||||
clearOpenTabsTask,
|
||||
|
||||
292
src/public/javascripts/services/note_detail_book.js
Normal file
292
src/public/javascripts/services/note_detail_book.js
Normal file
@@ -0,0 +1,292 @@
|
||||
import server from "./server.js";
|
||||
import linkService from "./link.js";
|
||||
import utils from "./utils.js";
|
||||
import treeCache from "./tree_cache.js";
|
||||
import renderService from "./render.js";
|
||||
import protectedSessionHolder from "./protected_session_holder.js";
|
||||
import protectedSessionService from "./protected_session.js";
|
||||
|
||||
const MIN_ZOOM_LEVEL = 1;
|
||||
const MAX_ZOOM_LEVEL = 6;
|
||||
|
||||
const ZOOMS = {
|
||||
1: {
|
||||
width: "100%",
|
||||
height: "100%"
|
||||
},
|
||||
2: {
|
||||
width: "49%",
|
||||
height: "350px"
|
||||
},
|
||||
3: {
|
||||
width: "32%",
|
||||
height: "250px"
|
||||
},
|
||||
4: {
|
||||
width: "24%",
|
||||
height: "200px"
|
||||
},
|
||||
5: {
|
||||
width: "19%",
|
||||
height: "175px"
|
||||
},
|
||||
6: {
|
||||
width: "16%",
|
||||
height: "150px"
|
||||
}
|
||||
};
|
||||
|
||||
class NoteDetailBook {
|
||||
/**
|
||||
* @param {TabContext} ctx
|
||||
*/
|
||||
constructor(ctx) {
|
||||
this.ctx = ctx;
|
||||
this.$component = ctx.$tabContent.find('.note-detail-book');
|
||||
this.$content = this.$component.find('.note-detail-book-content');
|
||||
this.$zoomInButton = this.$component.find('.book-zoom-in-button');
|
||||
this.$zoomOutButton = this.$component.find('.book-zoom-out-button');
|
||||
this.$expandChildrenButton = this.$component.find('.expand-children-button');
|
||||
|
||||
this.$zoomInButton.click(() => this.setZoom(this.zoomLevel - 1));
|
||||
this.$zoomOutButton.click(() => this.setZoom(this.zoomLevel + 1));
|
||||
|
||||
this.$expandChildrenButton.click(async () => {
|
||||
for (let i = 1; i < 30; i++) { // protection against infinite cycle
|
||||
const $unexpandedLinks = this.$content.find('.note-book-open-children-button:visible');
|
||||
|
||||
if ($unexpandedLinks.length === 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (const link of $unexpandedLinks) {
|
||||
const $card = $(link).closest(".note-book-card");
|
||||
|
||||
await this.expandCard($card);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.$content.on('click', '.note-book-open-children-button', async ev => {
|
||||
const $card = $(ev.target).closest('.note-book-card');
|
||||
|
||||
await this.expandCard($card);
|
||||
});
|
||||
|
||||
this.$content.on('click', '.note-book-hide-children-button', async ev => {
|
||||
const $card = $(ev.target).closest('.note-book-card');
|
||||
|
||||
$card.find('.note-book-open-children-button').show();
|
||||
$card.find('.note-book-hide-children-button').hide();
|
||||
|
||||
$card.find('.note-book-children-content').empty();
|
||||
});
|
||||
}
|
||||
|
||||
async expandCard($card) {
|
||||
const noteId = $card.attr('data-note-id');
|
||||
const note = await treeCache.getNote(noteId);
|
||||
|
||||
$card.find('.note-book-open-children-button').hide();
|
||||
$card.find('.note-book-hide-children-button').show();
|
||||
|
||||
await this.renderIntoElement(note, $card.find('.note-book-children-content'));
|
||||
}
|
||||
|
||||
setZoom(zoomLevel) {
|
||||
if (!(zoomLevel in ZOOMS)) {
|
||||
zoomLevel = this.getDefaultZoomLevel();
|
||||
}
|
||||
|
||||
this.zoomLevel = zoomLevel;
|
||||
|
||||
this.$zoomInButton.prop("disabled", zoomLevel === MIN_ZOOM_LEVEL);
|
||||
this.$zoomOutButton.prop("disabled", zoomLevel === MAX_ZOOM_LEVEL);
|
||||
|
||||
this.$content.find('.note-book-card').css("flex-basis", ZOOMS[zoomLevel].width);
|
||||
this.$content.find('.note-book-content').css("max-height", ZOOMS[zoomLevel].height);
|
||||
}
|
||||
|
||||
async render() {
|
||||
this.$content.empty();
|
||||
|
||||
if (this.isAutoBook()) {
|
||||
const $addTextLink = $('<a href="javascript:">here</a>').click(() => {
|
||||
this.ctx.renderComponent(true);
|
||||
});
|
||||
|
||||
this.$content.append($('<div class="note-book-auto-message"></div>')
|
||||
.append(`This note doesn't have any content so we display its children. Click `)
|
||||
.append($addTextLink)
|
||||
.append(' if you want to add some text.'))
|
||||
}
|
||||
|
||||
const zoomLevel = parseInt(await this.ctx.note.getLabelValue('bookZoomLevel')) || this.getDefaultZoomLevel();
|
||||
this.setZoom(zoomLevel);
|
||||
|
||||
await this.renderIntoElement(this.ctx.note, this.$content);
|
||||
}
|
||||
|
||||
async renderIntoElement(note, $container) {
|
||||
for (const childNote of await note.getChildNotes()) {
|
||||
const type = this.getRenderingType(childNote);
|
||||
|
||||
const $card = $('<div class="note-book-card">')
|
||||
.attr('data-note-id', childNote.noteId)
|
||||
.css("flex-basis", ZOOMS[this.zoomLevel].width)
|
||||
.addClass("type-" + type)
|
||||
.append($('<h5 class="note-book-title">').append(await linkService.createNoteLink(childNote.noteId, null, false)))
|
||||
.append($('<div class="note-book-content">')
|
||||
.css("max-height", ZOOMS[this.zoomLevel].height)
|
||||
.append(await this.getNoteContent(type, childNote)));
|
||||
|
||||
const childCount = childNote.getChildNoteIds().length;
|
||||
|
||||
if (childCount > 0) {
|
||||
const label = `${childCount} child${childCount > 1 ? 'ren' : ''}`;
|
||||
|
||||
$card.append($('<div class="note-book-children">')
|
||||
.append($(`<a class="note-book-open-children-button" href="javascript:">+ Show ${label}</a>`))
|
||||
.append($(`<a class="note-book-hide-children-button" href="javascript:">- Hide ${label}</a>`).hide())
|
||||
.append($('<div class="note-book-children-content">'))
|
||||
);
|
||||
}
|
||||
|
||||
$container.append($card);
|
||||
}
|
||||
}
|
||||
|
||||
async getNoteContent(type, note) {
|
||||
if (type === 'text') {
|
||||
const fullNote = await server.get('notes/' + note.noteId);
|
||||
|
||||
const $content = $("<div>").html(fullNote.content);
|
||||
|
||||
if (utils.isHtmlEmpty(fullNote.content)) {
|
||||
return "";
|
||||
}
|
||||
else {
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
else if (type === 'code') {
|
||||
const fullNote = await server.get('notes/' + note.noteId);
|
||||
|
||||
if (fullNote.content.trim() === "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return $("<pre>").text(fullNote.content);
|
||||
}
|
||||
else if (type === 'image') {
|
||||
return $("<img>").attr("src", `api/images/${note.noteId}/${note.title}`);
|
||||
}
|
||||
else if (type === 'file') {
|
||||
function getFileUrl() {
|
||||
// electron needs absolute URL so we extract current host, port, protocol
|
||||
return utils.getHost() + "/api/notes/" + note.noteId + "/download";
|
||||
}
|
||||
|
||||
const $downloadButton = $('<button class="file-download btn btn-primary" type="button">Download</button>');
|
||||
const $openButton = $('<button class="file-open btn btn-primary" type="button">Open</button>');
|
||||
|
||||
$downloadButton.click(() => utils.download(getFileUrl()));
|
||||
$openButton.click(() => {
|
||||
if (utils.isElectron()) {
|
||||
const open = require("open");
|
||||
|
||||
open(getFileUrl(), {url: true});
|
||||
}
|
||||
else {
|
||||
window.location.href = getFileUrl();
|
||||
}
|
||||
});
|
||||
|
||||
// open doesn't work for protected notes since it works through browser which isn't in protected session
|
||||
$openButton.toggle(!note.isProtected);
|
||||
|
||||
return $('<div>')
|
||||
.append($downloadButton)
|
||||
.append(' ')
|
||||
.append($openButton);
|
||||
}
|
||||
else if (type === 'render') {
|
||||
const $el = $('<div>');
|
||||
|
||||
await renderService.render(note, $el, this.ctx);
|
||||
|
||||
return $el;
|
||||
}
|
||||
else if (type === 'protected-session') {
|
||||
const $button = $(`<button class="btn btn-sm"><span class="jam jam-door"></span> Enter protected session</button>`)
|
||||
.click(protectedSessionService.enterProtectedSession);
|
||||
|
||||
return $("<div>")
|
||||
.append("<div>This note is protected and to access it you need to enter password.</div>")
|
||||
.append("<br/>")
|
||||
.append($button);
|
||||
}
|
||||
else {
|
||||
return "<em>Content of this note cannot be displayed in the book format</em>";
|
||||
}
|
||||
}
|
||||
|
||||
/** @return {boolean} true if this is "auto book" activated (empty text note) and not explicit book note */
|
||||
isAutoBook() {
|
||||
return this.ctx.note.type !== 'book';
|
||||
}
|
||||
|
||||
getDefaultZoomLevel() {
|
||||
if (this.isAutoBook()) {
|
||||
const w = this.$component.width();
|
||||
|
||||
if (w <= 600) {
|
||||
return 1;
|
||||
} else if (w <= 900) {
|
||||
return 2;
|
||||
} else if (w <= 1300) {
|
||||
return 3;
|
||||
} else {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
getRenderingType(childNote) {
|
||||
let type = childNote.type;
|
||||
|
||||
if (childNote.isProtected) {
|
||||
if (protectedSessionHolder.isProtectedSessionAvailable()) {
|
||||
protectedSessionHolder.touchProtectedSession();
|
||||
}
|
||||
else {
|
||||
type = 'protected-session';
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
getContent() {}
|
||||
|
||||
show() {
|
||||
this.$component.show();
|
||||
}
|
||||
|
||||
focus() {}
|
||||
|
||||
onNoteChange() {}
|
||||
|
||||
cleanup() {
|
||||
this.$content.empty();
|
||||
}
|
||||
|
||||
scrollToTop() {
|
||||
this.$component.scrollTop(0);
|
||||
}
|
||||
}
|
||||
|
||||
export default NoteDetailBook;
|
||||
@@ -1,6 +1,6 @@
|
||||
import libraryLoader from "./library_loader.js";
|
||||
import bundleService from "./bundle.js";
|
||||
import infoService from "./info.js";
|
||||
import toastService from "./toast.js";
|
||||
import server from "./server.js";
|
||||
import noteDetailService from "./note_detail.js";
|
||||
import utils from "./utils.js";
|
||||
@@ -102,7 +102,7 @@ class NoteDetailCode {
|
||||
await server.post('script/run/' + this.ctx.note.noteId);
|
||||
}
|
||||
|
||||
infoService.showMessage("Note executed");
|
||||
toastService.showMessage("Note executed");
|
||||
}
|
||||
|
||||
onNoteChange(func) {
|
||||
|
||||
@@ -23,7 +23,7 @@ class NoteDetailFile {
|
||||
if (utils.isElectron()) {
|
||||
const open = require("open");
|
||||
|
||||
open(this.getFileUrl());
|
||||
open(this.getFileUrl(), {url: true});
|
||||
}
|
||||
else {
|
||||
window.location.href = this.getFileUrl();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import utils from "./utils.js";
|
||||
import infoService from "./info.js";
|
||||
import toastService from "./toast.js";
|
||||
import server from "./server.js";
|
||||
|
||||
class NoteDetailImage {
|
||||
@@ -28,10 +28,10 @@ class NoteDetailImage {
|
||||
const success = document.execCommand('copy');
|
||||
|
||||
if (success) {
|
||||
infoService.showMessage("Image copied to the clipboard");
|
||||
toastService.showMessage("Image copied to the clipboard");
|
||||
}
|
||||
else {
|
||||
infoService.showAndLogError("Could not copy the image to clipboard.");
|
||||
toastService.showAndLogError("Could not copy the image to clipboard.");
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
||||
@@ -4,7 +4,7 @@ import linkService from "./link.js";
|
||||
import libraryLoader from "./library_loader.js";
|
||||
import treeService from "./tree.js";
|
||||
import contextMenuWidget from "./context_menu.js";
|
||||
import infoService from "./info.js";
|
||||
import toastService from "./toast.js";
|
||||
import attributeAutocompleteService from "./attribute_autocomplete.js";
|
||||
|
||||
const uniDirectionalOverlays = [
|
||||
@@ -134,7 +134,7 @@ class NoteDetailRelationMap {
|
||||
target: 'into'
|
||||
});
|
||||
|
||||
infoService.showMessage("Click on canvas to place new note");
|
||||
toastService.showMessage("Click on canvas to place new note");
|
||||
|
||||
// reloading tree so that the new note appears there
|
||||
// no need to wait for it to finish
|
||||
@@ -576,7 +576,7 @@ class NoteDetailRelationMap {
|
||||
const exists = this.mapData.notes.some(n => n.noteId === note.noteId);
|
||||
|
||||
if (exists) {
|
||||
infoService.showError(`Note "${note.title}" is already in the diagram.`);
|
||||
toastService.showError(`Note "${note.title}" is already in the diagram.`);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import bundleService from "./bundle.js";
|
||||
import server from "./server.js";
|
||||
import renderService from "./render.js";
|
||||
|
||||
class NoteDetailRender {
|
||||
/**
|
||||
@@ -16,29 +15,10 @@ class NoteDetailRender {
|
||||
}
|
||||
|
||||
async render() {
|
||||
const attributes = await this.ctx.attributes.getAttributes();
|
||||
const renderNotes = attributes.filter(attr =>
|
||||
attr.type === 'relation'
|
||||
&& attr.name === 'renderNote'
|
||||
&& !!attr.value);
|
||||
|
||||
this.$component.show();
|
||||
this.$noteDetailRenderHelp.hide();
|
||||
|
||||
this.$noteDetailRenderContent.empty();
|
||||
this.$noteDetailRenderContent.toggle(renderNotes.length > 0);
|
||||
this.$noteDetailRenderHelp.toggle(renderNotes.length === 0);
|
||||
|
||||
for (const renderNote of renderNotes) {
|
||||
const bundle = await server.get('script/bundle/' + renderNote.value);
|
||||
|
||||
this.$noteDetailRenderContent.append(bundle.html);
|
||||
|
||||
const $result = await bundleService.executeBundle(bundle, this.ctx.note, this.ctx);
|
||||
|
||||
if ($result) {
|
||||
this.$noteDetailRenderContent.append($result);
|
||||
}
|
||||
}
|
||||
await renderService.render(this.ctx.note, this.$noteDetailRenderContent, this.ctx);
|
||||
}
|
||||
|
||||
getContent() {}
|
||||
|
||||
@@ -11,6 +11,7 @@ const NOTE_TYPES = [
|
||||
{ type: "text", mime: "text/html", title: "Text", selectable: true },
|
||||
{ type: "relation-map", mime: "application/json", title: "Relation Map", selectable: true },
|
||||
{ type: "render", mime: '', title: "Render Note", selectable: true },
|
||||
{ type: "book", mime: '', title: "Book", selectable: true },
|
||||
{ type: "code", mime: 'text/plain', title: "Code", selectable: true }
|
||||
];
|
||||
|
||||
|
||||
@@ -51,7 +51,11 @@ function reloadOptions() {
|
||||
return optionsReady;
|
||||
}
|
||||
|
||||
/** just waits for some options without triggering reload */
|
||||
/**
|
||||
* just waits for some options without triggering reload
|
||||
*
|
||||
* @return {Options}
|
||||
*/
|
||||
async function waitForOptions() {
|
||||
return await optionsReady;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@ import noteDetailService from './note_detail.js';
|
||||
import utils from './utils.js';
|
||||
import server from './server.js';
|
||||
import protectedSessionHolder from './protected_session_holder.js';
|
||||
import infoService from "./info.js";
|
||||
import toastService from "./toast.js";
|
||||
import ws from "./ws.js";
|
||||
|
||||
const $enterProtectedSessionButton = $("#enter-protected-session-button");
|
||||
const $leaveProtectedSessionButton = $("#leave-protected-session-button");
|
||||
@@ -37,7 +38,7 @@ async function setupProtectedSession(password) {
|
||||
const response = await enterProtectedSessionOnServer(password);
|
||||
|
||||
if (!response.success) {
|
||||
infoService.showError("Wrong password.", 3000);
|
||||
toastService.showError("Wrong password.", 3000);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,8 +47,7 @@ async function setupProtectedSession(password) {
|
||||
|
||||
await treeService.reload();
|
||||
|
||||
// it's important that tree has been already reloaded at this point since detail also uses tree cache (for children overview)
|
||||
// children overview is the reason why we need to reload all tabs
|
||||
// it's important that tree has been already reloaded at this point since detail also uses tree cache (for book)
|
||||
await noteDetailService.reloadAllTabs();
|
||||
|
||||
if (protectedSessionDeferred !== null) {
|
||||
@@ -60,7 +60,7 @@ async function setupProtectedSession(password) {
|
||||
$enterProtectedSessionButton.hide();
|
||||
$leaveProtectedSessionButton.show();
|
||||
|
||||
infoService.showMessage("Protected session has been started.");
|
||||
toastService.showMessage("Protected session has been started.");
|
||||
}
|
||||
|
||||
async function enterProtectedSessionOnServer(password) {
|
||||
@@ -70,13 +70,13 @@ async function enterProtectedSessionOnServer(password) {
|
||||
}
|
||||
|
||||
async function protectNoteAndSendToServer() {
|
||||
if (!noteDetailService.getActiveNote() || noteDetailService.getActiveNote().isProtected) {
|
||||
if (!noteDetailService.getActiveTabNote() || noteDetailService.getActiveTabNote().isProtected) {
|
||||
return;
|
||||
}
|
||||
|
||||
await enterProtectedSession();
|
||||
|
||||
const note = noteDetailService.getActiveNote();
|
||||
const note = noteDetailService.getActiveTabNote();
|
||||
note.isProtected = true;
|
||||
|
||||
await noteDetailService.getActiveTabContext().saveNote();
|
||||
@@ -87,10 +87,10 @@ async function protectNoteAndSendToServer() {
|
||||
}
|
||||
|
||||
async function unprotectNoteAndSendToServer() {
|
||||
const activeNote = noteDetailService.getActiveNote();
|
||||
const activeNote = noteDetailService.getActiveTabNote();
|
||||
|
||||
if (!activeNote.isProtected) {
|
||||
infoService.showAndLogError(`Note ${activeNote.noteId} is not protected`);
|
||||
toastService.showAndLogError(`Note ${activeNote.noteId} is not protected`);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -118,12 +118,39 @@ async function protectSubtree(noteId, protect) {
|
||||
|
||||
await server.put('notes/' + noteId + "/protect/" + (protect ? 1 : 0));
|
||||
|
||||
infoService.showMessage("Request to un/protect sub tree has finished successfully");
|
||||
|
||||
treeService.reload();
|
||||
noteDetailService.reload();
|
||||
}
|
||||
|
||||
function makeToast(message, protectingLabel, text) {
|
||||
return {
|
||||
id: message.taskId,
|
||||
title: protectingLabel + " status",
|
||||
message: text,
|
||||
icon: message.data.protect ? "shield-check" : "shield-close"
|
||||
};
|
||||
}
|
||||
|
||||
ws.subscribeToMessages(async message => {
|
||||
if (message.taskType !== 'protect-notes') {
|
||||
return;
|
||||
}
|
||||
|
||||
const protectingLabel = message.data.protect ? "Protecting" : "Unprotecting";
|
||||
|
||||
if (message.type === 'task-error') {
|
||||
toastService.closePersistent(message.taskId);
|
||||
toastService.showError(message.message);
|
||||
} else if (message.type === 'task-progress-count') {
|
||||
toastService.showPersistent(makeToast(message, protectingLabel,protectingLabel + " in progress: " + message.progressCount));
|
||||
} else if (message.type === 'task-succeeded') {
|
||||
const toast = makeToast(message, protectingLabel, protectingLabel + " finished successfully.");
|
||||
toast.closeAfter = 3000;
|
||||
|
||||
toastService.showPersistent(toast);
|
||||
}
|
||||
});
|
||||
|
||||
export default {
|
||||
protectSubtree,
|
||||
enterProtectedSession,
|
||||
|
||||
33
src/public/javascripts/services/render.js
Normal file
33
src/public/javascripts/services/render.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import server from "./server.js";
|
||||
import bundleService from "./bundle.js";
|
||||
|
||||
async function render(note, $el, ctx) {
|
||||
const attributes = await note.getAttributes();
|
||||
const renderNoteIds = attributes.filter(attr =>
|
||||
attr.type === 'relation'
|
||||
&& attr.name === 'renderNote'
|
||||
&& !!attr.value).map(rel => rel.value);
|
||||
|
||||
$el.empty().toggle(renderNoteIds.length > 0);
|
||||
|
||||
for (const renderNoteId of renderNoteIds) {
|
||||
const bundle = await server.get('script/bundle/' + renderNoteId);
|
||||
|
||||
const $scriptContainer = $('<div>');
|
||||
$el.append($scriptContainer);
|
||||
|
||||
$scriptContainer.append(bundle.html);
|
||||
|
||||
const $result = await bundleService.executeBundle(bundle, note, ctx, $scriptContainer);
|
||||
|
||||
if ($result) {
|
||||
$scriptContainer.append($result);
|
||||
}
|
||||
}
|
||||
|
||||
return renderNoteIds.length > 0;
|
||||
}
|
||||
|
||||
export default {
|
||||
render
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user