mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Merge branch 'math2'
# Conflicts: # package-lock.json # package.json
This commit is contained in:
commit
4591899df0
18
.idea/codeStyles/Project.xml
generated
18
.idea/codeStyles/Project.xml
generated
@ -9,5 +9,23 @@
|
||||
<JSCodeStyleSettings version="0">
|
||||
<option name="USE_EXPLICIT_JS_EXTENSION" value="TRUE" />
|
||||
</JSCodeStyleSettings>
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
<value>
|
||||
<package name="java.util" alias="false" withSubpackages="false" />
|
||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||
<value>
|
||||
<package name="" alias="false" withSubpackages="true" />
|
||||
<package name="java" alias="false" withSubpackages="true" />
|
||||
<package name="javax" alias="false" withSubpackages="true" />
|
||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||
<package name="" alias="true" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
</JetCodeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PKG_DIR=dist/trilium-linux-x64-server
|
||||
NODE_VERSION=12.18.3
|
||||
NODE_VERSION=12.19.0
|
||||
|
||||
if [ "$1" != "DONTCOPY" ]
|
||||
then
|
||||
|
BIN
db/demo.zip
BIN
db/demo.zip
Binary file not shown.
@ -335,7 +335,7 @@ class NoteShort {
|
||||
getAttribute(type, name) {
|
||||
const attributes = this.getAttributes(type, name);
|
||||
|
||||
return attributes.length > 0 ? attributes[0] : 0;
|
||||
return attributes.length > 0 ? attributes[0] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
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
91
libraries/katex/README.md
Normal file
91
libraries/katex/README.md
Normal file
@ -0,0 +1,91 @@
|
||||
# [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/)
|
||||
[](https://www.npmjs.com/package/katex)
|
||||
[](https://circleci.com/gh/KaTeX/KaTeX)
|
||||
[](https://codecov.io/gh/KaTeX/KaTeX)
|
||||
[](https://gitter.im/KaTeX/KaTeX?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://dependabot.com)
|
||||
[](https://www.jsdelivr.com/package/npm/katex)
|
||||

|
||||
|
||||
KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web.
|
||||
|
||||
* **Fast:** KaTeX renders its math synchronously and doesn't need to reflow the page. See how it compares to a competitor in [this speed test](http://www.intmath.com/cg5/katex-mathjax-comparison.php).
|
||||
* **Print quality:** KaTeX's layout is based on Donald Knuth's TeX, the gold standard for math typesetting.
|
||||
* **Self contained:** KaTeX has no dependencies and can easily be bundled with your website resources.
|
||||
* **Server side rendering:** KaTeX produces the same output regardless of browser or environment, so you can pre-render expressions using Node.js and send them as plain HTML.
|
||||
|
||||
KaTeX is compatible with all major browsers, including Chrome, Safari, Firefox, Opera, Edge, and IE 11.
|
||||
|
||||
KaTeX supports much (but not all) of LaTeX and many LaTeX packages. See the [list of supported functions](https://katex.org/docs/supported.html).
|
||||
|
||||
Try out KaTeX [on the demo page](https://katex.org/#demo)!
|
||||
|
||||
## Getting started
|
||||
|
||||
### Starter template
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
|
||||
|
||||
<!-- The loading of KaTeX is deferred to speed up page rendering -->
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- To automatically render math in text elements, include the auto-render extension: -->
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"
|
||||
onload="renderMathInElement(document.body);"></script>
|
||||
</head>
|
||||
...
|
||||
</html>
|
||||
```
|
||||
|
||||
You can also [download KaTeX](https://github.com/KaTeX/KaTeX/releases) and host it yourself.
|
||||
|
||||
For details on how to configure auto-render extension, refer to [the documentation](https://katex.org/docs/autorender.html).
|
||||
|
||||
### API
|
||||
|
||||
Call `katex.render` to render a TeX expression directly into a DOM element.
|
||||
For example:
|
||||
|
||||
```js
|
||||
katex.render("c = \\pm\\sqrt{a^2 + b^2}", element, {
|
||||
throwOnError: false
|
||||
});
|
||||
```
|
||||
|
||||
Call `katex.renderToString` to generate an HTML string of the rendered math,
|
||||
e.g., for server-side rendering. For example:
|
||||
|
||||
```js
|
||||
var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}", {
|
||||
throwOnError: false
|
||||
});
|
||||
// '<span class="katex">...</span>'
|
||||
```
|
||||
|
||||
Make sure to include the CSS and font files in both cases.
|
||||
If you are doing all rendering on the server, there is no need to include the
|
||||
JavaScript on the client.
|
||||
|
||||
The examples above use the `throwOnError: false` option, which renders invalid
|
||||
inputs as the TeX source code in red (by default), with the error message as
|
||||
hover text. For other available options, see the
|
||||
[API documentation](https://katex.org/docs/api.html),
|
||||
[options documentation](https://katex.org/docs/options.html), and
|
||||
[handling errors documentation](https://katex.org/docs/error.html).
|
||||
|
||||
## Demo and Documentation
|
||||
|
||||
Learn more about using KaTeX [on the website](https://katex.org)!
|
||||
|
||||
## Contributing
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||
|
||||
## License
|
||||
|
||||
KaTeX is licensed under the [MIT License](http://opensource.org/licenses/MIT).
|
1
libraries/katex/auto-render.min.js
vendored
Normal file
1
libraries/katex/auto-render.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),a=function(e,t,r){for(var n=r,o=0,a=e.length;n<t.length;){var i=t[n];if(o<=0&&t.slice(n,n+a)===e)return n;"\\"===i?n++:"{"===i?o++:"}"===i&&o--,n++}return-1},i=function(e,t,r,n){for(var o=[],i=0;i<e.length;i++)if("text"===e[i].type){var l=e[i].data,d=!0,s=0,f=void 0;for(-1!==(f=l.indexOf(t))&&(s=f,o.push({type:"text",data:l.slice(0,s)}),d=!1);;){if(d){if(-1===(f=l.indexOf(t,s)))break;o.push({type:"text",data:l.slice(s,f)}),s=f}else{if(-1===(f=a(r,l,s+t.length)))break;o.push({type:"math",data:l.slice(s+t.length,f),rawData:l.slice(s,f+r.length),display:n}),s=f+r.length}d=!d}o.push({type:"text",data:l.slice(s)})}else o.push(e[i]);return o},l=function(e,t){var r=function(e,t){for(var r=[{type:"text",data:e}],n=0;n<t.length;n++){var o=t[n];r=i(r,o.left,o.right,o.display||!1)}return r}(e,t.delimiters);if(1===r.length&&"text"===r[0].type)return null;for(var n=document.createDocumentFragment(),a=0;a<r.length;a++)if("text"===r[a].type)n.appendChild(document.createTextNode(r[a].data));else{var l=document.createElement("span"),d=r[a].data;t.displayMode=r[a].display;try{t.preProcess&&(d=t.preProcess(d)),o.a.render(d,l,t)}catch(e){if(!(e instanceof o.a.ParseError))throw e;t.errorCallback("KaTeX auto-render: Failed to parse `"+r[a].data+"` with ",e),n.appendChild(document.createTextNode(r[a].rawData));continue}n.appendChild(l)}return n};t.default=function(e,t){if(!e)throw new Error("No element provided to render");var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);r.delimiters=r.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\[",right:"\\]",display:!0}],r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code","option"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},function e(t,r){for(var n=0;n<t.childNodes.length;n++){var o=t.childNodes[n];if(3===o.nodeType){var a=l(o.textContent,r);a&&(n+=a.childNodes.length-1,t.replaceChild(a,o))}else 1===o.nodeType&&function(){var t=" "+o.className+" ";-1===r.ignoredTags.indexOf(o.nodeName.toLowerCase())&&r.ignoredClasses.every(function(e){return-1===t.indexOf(" "+e+" ")})&&e(o,r)}()}}(e,r)}}]).default});
|
BIN
libraries/katex/fonts/KaTeX_AMS-Regular.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_AMS-Regular.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_AMS-Regular.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_AMS-Regular.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_AMS-Regular.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_AMS-Regular.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Caligraphic-Bold.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Caligraphic-Bold.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Caligraphic-Bold.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Caligraphic-Bold.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Caligraphic-Bold.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Caligraphic-Bold.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Caligraphic-Regular.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Caligraphic-Regular.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Caligraphic-Regular.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Caligraphic-Regular.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Caligraphic-Regular.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Caligraphic-Regular.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Fraktur-Bold.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Fraktur-Bold.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Fraktur-Bold.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Fraktur-Bold.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Fraktur-Bold.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Fraktur-Bold.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Fraktur-Regular.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Fraktur-Regular.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Fraktur-Regular.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Fraktur-Regular.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Fraktur-Regular.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Fraktur-Regular.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Main-Bold.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Main-Bold.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Main-Bold.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Main-Bold.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Main-Bold.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Main-Bold.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Main-BoldItalic.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Main-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Main-BoldItalic.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Main-BoldItalic.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Main-BoldItalic.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Main-BoldItalic.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Main-Italic.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Main-Italic.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Main-Italic.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Main-Italic.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Main-Italic.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Main-Italic.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Main-Regular.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Main-Regular.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Main-Regular.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Main-Regular.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Main-Regular.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Main-Regular.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Math-BoldItalic.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Math-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Math-BoldItalic.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Math-BoldItalic.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Math-BoldItalic.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Math-BoldItalic.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Math-Italic.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Math-Italic.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Math-Italic.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Math-Italic.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Math-Italic.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Math-Italic.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_SansSerif-Bold.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_SansSerif-Bold.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_SansSerif-Bold.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_SansSerif-Bold.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_SansSerif-Bold.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_SansSerif-Bold.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_SansSerif-Italic.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_SansSerif-Italic.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_SansSerif-Italic.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_SansSerif-Italic.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_SansSerif-Italic.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_SansSerif-Italic.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_SansSerif-Regular.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_SansSerif-Regular.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_SansSerif-Regular.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_SansSerif-Regular.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_SansSerif-Regular.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_SansSerif-Regular.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Script-Regular.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Script-Regular.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Script-Regular.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Script-Regular.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Script-Regular.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Script-Regular.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Size1-Regular.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Size1-Regular.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Size1-Regular.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Size1-Regular.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Size1-Regular.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Size1-Regular.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Size2-Regular.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Size2-Regular.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Size2-Regular.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Size2-Regular.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Size2-Regular.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Size2-Regular.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Size3-Regular.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Size3-Regular.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Size3-Regular.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Size3-Regular.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Size3-Regular.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Size3-Regular.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Size4-Regular.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Size4-Regular.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Size4-Regular.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Size4-Regular.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Size4-Regular.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Size4-Regular.woff2
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Typewriter-Regular.ttf
Normal file
BIN
libraries/katex/fonts/KaTeX_Typewriter-Regular.ttf
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Typewriter-Regular.woff
Normal file
BIN
libraries/katex/fonts/KaTeX_Typewriter-Regular.woff
Normal file
Binary file not shown.
BIN
libraries/katex/fonts/KaTeX_Typewriter-Regular.woff2
Normal file
BIN
libraries/katex/fonts/KaTeX_Typewriter-Regular.woff2
Normal file
Binary file not shown.
1035
libraries/katex/katex.css
Normal file
1035
libraries/katex/katex.css
Normal file
File diff suppressed because it is too large
Load Diff
17308
libraries/katex/katex.js
Normal file
17308
libraries/katex/katex.js
Normal file
File diff suppressed because it is too large
Load Diff
1
libraries/katex/katex.min.css
vendored
Normal file
1
libraries/katex/katex.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
libraries/katex/katex.min.js
vendored
Normal file
1
libraries/katex/katex.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
16911
libraries/katex/katex.mjs
Normal file
16911
libraries/katex/katex.mjs
Normal file
File diff suppressed because it is too large
Load Diff
5465
package-lock.json
generated
5465
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
21
package.json
21
package.json
@ -2,7 +2,7 @@
|
||||
"name": "trilium",
|
||||
"productName": "Trilium Notes",
|
||||
"description": "Trilium Notes",
|
||||
"version": "0.44.6",
|
||||
"version": "0.45.0-beta",
|
||||
"license": "AGPL-3.0-only",
|
||||
"main": "electron.js",
|
||||
"bin": {
|
||||
@ -32,7 +32,7 @@
|
||||
"commonmark": "0.29.2",
|
||||
"cookie-parser": "1.4.5",
|
||||
"csurf": "1.11.0",
|
||||
"dayjs": "1.9.1",
|
||||
"dayjs": "1.9.3",
|
||||
"ejs": "3.1.5",
|
||||
"electron-debug": "3.1.0",
|
||||
"electron-dl": "3.0.2",
|
||||
@ -40,7 +40,7 @@
|
||||
"electron-window-state": "5.0.3",
|
||||
"express": "4.17.1",
|
||||
"express-session": "1.17.1",
|
||||
"file-type": "15.0.1",
|
||||
"file-type": "16.0.0",
|
||||
"fs-extra": "9.0.1",
|
||||
"helmet": "4.1.1",
|
||||
"html": "1.0.0",
|
||||
@ -61,13 +61,14 @@
|
||||
"request": "^2.88.2",
|
||||
"rimraf": "3.0.2",
|
||||
"sanitize-filename": "1.6.3",
|
||||
"sanitize-html": "2.1.0",
|
||||
"sanitize-html": "2.1.1",
|
||||
"sax": "1.2.4",
|
||||
"semver": "7.3.2",
|
||||
"serve-favicon": "2.5.0",
|
||||
"session-file-store": "1.5.0",
|
||||
"striptags": "3.1.1",
|
||||
"turndown": "6.0.0",
|
||||
"tmp": "^0.2.1",
|
||||
"turndown": "7.0.0",
|
||||
"turndown-plugin-gfm": "1.0.2",
|
||||
"unescape": "1.0.1",
|
||||
"ws": "7.3.1",
|
||||
@ -77,16 +78,16 @@
|
||||
"devDependencies": {
|
||||
"cross-env": "7.0.2",
|
||||
"electron": "9.3.2",
|
||||
"electron-builder": "22.8.1",
|
||||
"electron-builder": "22.9.1",
|
||||
"electron-packager": "15.1.0",
|
||||
"electron-rebuild": "2.2.0",
|
||||
"electron-rebuild": "2.3.2",
|
||||
"esm": "3.2.25",
|
||||
"jasmine": "3.6.1",
|
||||
"jasmine": "3.6.2",
|
||||
"jsdoc": "3.6.6",
|
||||
"lorem-ipsum": "2.0.3",
|
||||
"rcedit": "2.2.0",
|
||||
"webpack": "5.0.0-rc.4",
|
||||
"webpack-cli": "4.0.0-rc.1"
|
||||
"webpack": "5.1.3",
|
||||
"webpack-cli": "4.1.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"electron-installer-debian": "2.0.1"
|
||||
|
@ -86,7 +86,7 @@ $form.on('submit', () => {
|
||||
textTypeWidget.addLink(notePath, linkTitle);
|
||||
}
|
||||
else {
|
||||
console.error("No path to add link.");
|
||||
logError("No path to add link.");
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -61,7 +61,7 @@ $form.on('submit', () => {
|
||||
cloneNotesTo(notePath);
|
||||
}
|
||||
else {
|
||||
console.error("No path to clone to.");
|
||||
logError("No path to clone to.");
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -46,7 +46,7 @@ $form.on('submit', () => {
|
||||
includeNote(notePath);
|
||||
}
|
||||
else {
|
||||
console.error("No noteId to include.");
|
||||
logError("No noteId to include.");
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -51,7 +51,7 @@ $form.on('submit', () => {
|
||||
treeCache.getBranchId(parentNoteId, noteId).then(branchId => moveNotesTo(branchId));
|
||||
}
|
||||
else {
|
||||
console.error("No path to move to.");
|
||||
logError("No path to move to.");
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -157,8 +157,8 @@ async function setContentPane() {
|
||||
|
||||
if (fullNoteRevision.content) {
|
||||
$table.append($("<tr>").append(
|
||||
$("<th>").text("Preview:"),
|
||||
$("<td>").append(
|
||||
$('<td colspan="2">').append(
|
||||
$('<div style="font-weight: bold;">').text("Preview:"),
|
||||
$('<pre class="file-preview-content"></pre>')
|
||||
.text(fullNoteRevision.content)
|
||||
)
|
||||
@ -196,4 +196,4 @@ $list.on('focus', '.dropdown-item', e => {
|
||||
});
|
||||
|
||||
setContentPane();
|
||||
});
|
||||
});
|
||||
|
@ -21,6 +21,8 @@ class Branch {
|
||||
this.isExpanded = !!row.isExpanded;
|
||||
/** @param {boolean} */
|
||||
this.isDeleted = !!row.isDeleted;
|
||||
/** @param {boolean} */
|
||||
this.fromSearchNote = !!row.fromSearchNote;
|
||||
}
|
||||
|
||||
/** @returns {NoteShort} */
|
||||
@ -48,4 +50,4 @@ class Branch {
|
||||
}
|
||||
}
|
||||
|
||||
export default Branch;
|
||||
export default Branch;
|
||||
|
@ -5,6 +5,16 @@ import noteAttributeCache from "../services/note_attribute_cache.js";
|
||||
const LABEL = 'label';
|
||||
const RELATION = 'relation';
|
||||
|
||||
const NOTE_TYPE_ICONS = {
|
||||
"file": "bx bx-file",
|
||||
"image": "bx bx-image",
|
||||
"code": "bx bx-code",
|
||||
"render": "bx bx-extension",
|
||||
"search": "bx bx-file-find",
|
||||
"relation-map": "bx bx-map-alt",
|
||||
"book": "bx bx-book"
|
||||
};
|
||||
|
||||
/**
|
||||
* FIXME: since there's no "full note" anymore we can rename this to Note
|
||||
*
|
||||
@ -254,6 +264,31 @@ class NoteShort {
|
||||
return this.getAttributes(LABEL, name);
|
||||
}
|
||||
|
||||
getIcon(isFolder = false) {
|
||||
const iconCassLabels = this.getLabels('iconClass');
|
||||
|
||||
if (iconCassLabels.length > 0) {
|
||||
return iconCassLabels.map(l => l.value).join(' ');
|
||||
}
|
||||
else if (this.noteId === 'root') {
|
||||
return "bx bx-chevrons-right";
|
||||
}
|
||||
else if (this.type === 'text') {
|
||||
if (isFolder) {
|
||||
return "bx bx-folder";
|
||||
}
|
||||
else {
|
||||
return "bx bx-note";
|
||||
}
|
||||
}
|
||||
else if (this.type === 'code' && this.mime.startsWith('text/x-sql')) {
|
||||
return "bx bx-data";
|
||||
}
|
||||
else {
|
||||
return NOTE_TYPE_ICONS[this.type];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} [name] - relation name to filter
|
||||
* @returns {Attribute[]} all note's relations (attributes with type relation), including inherited ones
|
||||
@ -307,7 +342,7 @@ class NoteShort {
|
||||
getAttribute(type, name) {
|
||||
const attributes = this.getAttributes(type, name);
|
||||
|
||||
return attributes.length > 0 ? attributes[0] : 0;
|
||||
return attributes.length > 0 ? attributes[0] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,14 +62,19 @@ const RIGHT_PANE_CSS = `
|
||||
}
|
||||
|
||||
#right-pane .widget-header-action {
|
||||
color: var(--link-color) !important;
|
||||
cursor: pointer;
|
||||
color: var(--main-text-color) !important;
|
||||
text-decoration: none;
|
||||
font-size: large;
|
||||
position: relative;
|
||||
top: 2px;
|
||||
}
|
||||
|
||||
#right-pane .widget-help {
|
||||
color: var(--muted-text-color);
|
||||
position: relative;
|
||||
top: 2px;
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
#right-pane .widget-help.no-link:hover {
|
||||
@ -77,6 +82,18 @@ const RIGHT_PANE_CSS = `
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#right-pane .widget-toggle-button {
|
||||
cursor: pointer;
|
||||
color: var(--main-text-color) !important;
|
||||
position: relative;
|
||||
top: 2px;
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
#right-pane .widget-toggle-button:hover {
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
#right-pane .body-wrapper {
|
||||
overflow: auto;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ async function getWidgetBundlesByParent() {
|
||||
widget = await executeBundle(bundle);
|
||||
}
|
||||
catch (e) {
|
||||
console.error("Widget initialization failed: ", e);
|
||||
logError("Widget initialization failed: ", e);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,10 @@ export default class Entrypoints extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
async unhoistCommand() {
|
||||
hoistedNoteService.unhoist();
|
||||
}
|
||||
|
||||
copyWithoutFormattingCommand() {
|
||||
utils.copySelectionToClipboard();
|
||||
}
|
||||
|
@ -8,6 +8,10 @@ function getHoistedNoteId() {
|
||||
}
|
||||
|
||||
async function setHoistedNoteId(noteId) {
|
||||
if (getHoistedNoteId() === noteId) {
|
||||
return;
|
||||
}
|
||||
|
||||
await options.save('hoistedNoteId', noteId);
|
||||
|
||||
await treeCache.loadInitialTree();
|
||||
|
@ -111,5 +111,6 @@ export default {
|
||||
setElementActionHandler,
|
||||
updateDisplayedShortcuts,
|
||||
setupActionsForElement,
|
||||
getActionsForScope
|
||||
getActionsForScope,
|
||||
getAction
|
||||
};
|
||||
|
@ -48,6 +48,11 @@ const PRINT_THIS = {js: ["libraries/printThis.js"]};
|
||||
|
||||
const CALENDAR_WIDGET = {css: ["stylesheets/calendar.css"]};
|
||||
|
||||
const KATEX = {
|
||||
js: [ "libraries/katex/katex.min.js", "libraries/katex/auto-render.min.js" ],
|
||||
css: [ "libraries/katex/katex.min.css" ]
|
||||
};
|
||||
|
||||
async function requireLibrary(library) {
|
||||
if (library.css) {
|
||||
library.css.map(cssUrl => requireCss(cssUrl));
|
||||
@ -95,5 +100,6 @@ export default {
|
||||
RELATION_MAP,
|
||||
LINK_MAP,
|
||||
PRINT_THIS,
|
||||
CALENDAR_WIDGET
|
||||
CALENDAR_WIDGET,
|
||||
KATEX
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import treeService from './tree.js';
|
||||
import contextMenu from "./context_menu.js";
|
||||
import appContext from "./app_context.js";
|
||||
import treeCache from "./tree_cache.js";
|
||||
import utils from "./utils.js";
|
||||
|
||||
function getNotePathFromUrl(url) {
|
||||
const notePathMatch = /#(root[A-Za-z0-9/]*)$/.exec(url);
|
||||
@ -11,7 +12,7 @@ function getNotePathFromUrl(url) {
|
||||
|
||||
async function createNoteLink(notePath, options = {}) {
|
||||
if (!notePath || !notePath.trim()) {
|
||||
console.error("Missing note path");
|
||||
logError("Missing note path");
|
||||
|
||||
return $("<span>").text("[missing note]");
|
||||
}
|
||||
@ -89,9 +90,16 @@ function goToLink(e) {
|
||||
|| $link.hasClass("ck-link-actions__preview") // within edit link dialog single click suffices
|
||||
) {
|
||||
const address = $link.attr('href');
|
||||
console.log("address", address);
|
||||
if (address) {
|
||||
if (address.toLowerCase().startsWith('http')) {
|
||||
window.open(address, '_blank');
|
||||
}
|
||||
else if (address.toLowerCase().startsWith('file:') && utils.isElectron()) {
|
||||
const electron = utils.dynamicRequire('electron');
|
||||
|
||||
if (address && address.startsWith('http')) {
|
||||
window.open(address, '_blank');
|
||||
electron.shell.openPath(address);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -149,6 +157,18 @@ async function loadReferenceLinkTitle(noteId, $el) {
|
||||
$(document).on('click', "a", goToLink);
|
||||
$(document).on('auxclick', "a", goToLink); // to handle middle button
|
||||
$(document).on('contextmenu', 'a', linkContextMenu);
|
||||
$(document).on('dblclick', "a", e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
const $link = $(e.target).closest("a");
|
||||
|
||||
const address = $link.attr('href');
|
||||
|
||||
if (address && address.startsWith('http')) {
|
||||
window.open(address, '_blank');
|
||||
}
|
||||
});
|
||||
|
||||
export default {
|
||||
getNotePathFromUrl,
|
||||
|
@ -63,6 +63,27 @@ export default class LinkMap {
|
||||
noteIds.add(this.note.noteId);
|
||||
}
|
||||
|
||||
await treeCache.getNotes(Array.from(noteIds));
|
||||
|
||||
// pre-fetch the link titles, it's important to have hte construction afterwards synchronous
|
||||
// since jsPlumb caculates width of the element
|
||||
const $linkTitles = {};
|
||||
|
||||
for (const noteId of noteIds) {
|
||||
const note = await treeCache.getNote(noteId);
|
||||
|
||||
$linkTitles[noteId] = await linkService.createNoteLink(noteId, {title: note.title});
|
||||
|
||||
$linkTitles[noteId].on('click', e => {
|
||||
try {
|
||||
$linkTitles[noteId].tooltip('dispose');
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
linkService.goToLink(e);
|
||||
})
|
||||
}
|
||||
|
||||
// preload all notes
|
||||
const notes = await treeCache.getNotes(Array.from(noteIds), true);
|
||||
|
||||
@ -98,18 +119,15 @@ export default class LinkMap {
|
||||
.addClass("note-box")
|
||||
.prop("id", noteBoxId);
|
||||
|
||||
linkService.createNoteLink(noteId, {title: note.title}).then($link => {
|
||||
$link.on('click', e => {
|
||||
try {
|
||||
$link.tooltip('dispose');
|
||||
}
|
||||
catch (e) {}
|
||||
const $link = $linkTitles[noteId];
|
||||
|
||||
linkService.goToLink(e);
|
||||
});
|
||||
|
||||
$noteBox.append($("<span>").addClass("title").append($link));
|
||||
});
|
||||
$noteBox.append(
|
||||
$("<span>")
|
||||
.addClass(note.getIcon()),
|
||||
$("<span>")
|
||||
.addClass("title")
|
||||
.append($link)
|
||||
);
|
||||
|
||||
if (noteId === this.note.noteId) {
|
||||
$noteBox.addClass("link-map-active-note");
|
||||
@ -273,4 +291,4 @@ export default class LinkMap {
|
||||
noteIdToId(noteId) {
|
||||
return this.linkMapContainerId + "-note-" + noteId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class TabContext extends Component {
|
||||
resolvedNotePath = await treeService.resolveNotePath(inputNotePath);
|
||||
|
||||
if (!resolvedNotePath) {
|
||||
console.error(`Cannot resolve note path ${inputNotePath}`);
|
||||
logError(`Cannot resolve note path ${inputNotePath}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -47,6 +47,9 @@ class TabContext extends Component {
|
||||
if (await hoistedNoteService.checkNoteAccess(resolvedNotePath) === false) {
|
||||
return; // note is outside of hoisted subtree and user chose not to unhoist
|
||||
}
|
||||
|
||||
// if user choise to unhoist, cache was reloaded, but might not contain this note (since it's on unexpanded path)
|
||||
await treeCache.getNote(noteId);
|
||||
}
|
||||
|
||||
await this.triggerEvent('beforeNoteSwitch', {tabContext: this});
|
||||
@ -78,10 +81,19 @@ class TabContext extends Component {
|
||||
notePath: this.notePath
|
||||
});
|
||||
}
|
||||
|
||||
if (utils.isDesktop()) {
|
||||
// close dangling autocompletes after closing the tab
|
||||
$(".aa-input").autocomplete("close");
|
||||
}
|
||||
}
|
||||
|
||||
/** @property {NoteShort} */
|
||||
get note() {
|
||||
if (this.noteId && !(this.noteId in treeCache.notes)) {
|
||||
logError(`Cannot find tabContext's note id='${this.noteId}'`);
|
||||
}
|
||||
|
||||
return treeCache.notes[this.noteId];
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ async function resolveNotePathToSegments(notePath, logErrors = true) {
|
||||
|
||||
if (!parents.length) {
|
||||
if (logErrors) {
|
||||
ws.logError(`No parents found for ${childNoteId}`);
|
||||
ws.logError(`No parents found for ${childNoteId} (${child.title}) for path ${notePath}`);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -70,7 +70,9 @@ async function resolveNotePathToSegments(notePath, logErrors = true) {
|
||||
|
||||
if (!parents.some(p => p.noteId === parentNoteId)) {
|
||||
if (logErrors) {
|
||||
console.log(utils.now(), `Did not find parent ${parentNoteId} for child ${childNoteId}, available parents: ${parents.map(p => p.noteId)}`);
|
||||
const parent = treeCache.getNoteFromCache(parentNoteId);
|
||||
|
||||
console.log(utils.now(), `Did not find parent ${parentNoteId} (${parent ? parent.title : 'n/a'}) for child ${childNoteId} (${child.title}), available parents: ${parents.map(p => `${p.noteId} (${p.title})`)}`);
|
||||
}
|
||||
|
||||
const someNotePath = getSomeNotePath(parents[0]);
|
||||
@ -81,8 +83,6 @@ async function resolveNotePathToSegments(notePath, logErrors = true) {
|
||||
for (const noteId of pathToRoot) {
|
||||
effectivePath.push(noteId);
|
||||
}
|
||||
|
||||
effectivePath.push('root');
|
||||
}
|
||||
|
||||
break;
|
||||
@ -113,7 +113,7 @@ function getSomeNotePath(note) {
|
||||
const parents = cur.getParentNotes();
|
||||
|
||||
if (!parents.length) {
|
||||
console.error(`Can't find parents for note ${cur.noteId}`);
|
||||
logError(`Can't find parents for note ${cur.noteId}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ function getNoteIdAndParentIdFromNotePath(notePath) {
|
||||
|
||||
function getNotePath(node) {
|
||||
if (!node) {
|
||||
console.error("Node is null");
|
||||
logError("Node is null");
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -85,35 +85,53 @@ class TreeCache {
|
||||
for (const noteRow of noteRows) {
|
||||
const {noteId} = noteRow;
|
||||
|
||||
const oldNote = this.notes[noteId];
|
||||
let note = this.notes[noteId];
|
||||
|
||||
if (oldNote) {
|
||||
for (const childNoteId of oldNote.children) {
|
||||
const childNote = this.notes[childNoteId];
|
||||
if (note) {
|
||||
note.update(noteRow);
|
||||
|
||||
if (childNote) {
|
||||
childNote.parents = childNote.parents.filter(p => p !== noteId);
|
||||
// search note doesn't have child branches in database and all the children are virtual branches
|
||||
if (note.type !== 'search') {
|
||||
for (const childNoteId of note.children) {
|
||||
const childNote = this.notes[childNoteId];
|
||||
|
||||
delete this.branches[childNote.parentToBranch[noteId]];
|
||||
delete childNote.parentToBranch[noteId];
|
||||
if (childNote) {
|
||||
childNote.parents = childNote.parents.filter(p => p !== noteId);
|
||||
|
||||
delete this.branches[childNote.parentToBranch[noteId]];
|
||||
delete childNote.parentToBranch[noteId];
|
||||
}
|
||||
}
|
||||
|
||||
note.children = [];
|
||||
note.childToBranch = [];
|
||||
}
|
||||
|
||||
for (const parentNoteId of oldNote.parents) {
|
||||
// we want to remove all "real" branches (represented in the database) since those will be created
|
||||
// from branches argument but want to preserve all virtual ones from saved search
|
||||
note.parents = note.parents.filter(parentNoteId => {
|
||||
const parentNote = this.notes[parentNoteId];
|
||||
const branch = this.branches[parentNote.childToBranch[noteId]];
|
||||
|
||||
if (parentNote) {
|
||||
parentNote.children = parentNote.children.filter(p => p !== noteId);
|
||||
|
||||
delete this.branches[parentNote.childToBranch[noteId]];
|
||||
delete parentNote.childToBranch[noteId];
|
||||
if (!parentNote || !branch) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (branch.fromSearchNote) {
|
||||
return true;
|
||||
}
|
||||
|
||||
parentNote.children = parentNote.children.filter(p => p !== noteId);
|
||||
|
||||
delete this.branches[parentNote.childToBranch[noteId]];
|
||||
delete parentNote.childToBranch[noteId];
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.notes[noteId] = new NoteShort(this, noteRow);
|
||||
}
|
||||
|
||||
const note = new NoteShort(this, noteRow);
|
||||
|
||||
this.notes[note.noteId] = note;
|
||||
}
|
||||
|
||||
for (const branchRow of branchRows) {
|
||||
@ -187,7 +205,8 @@ class TreeCache {
|
||||
branchId: "virt" + resultNoteId + '-' + note.noteId,
|
||||
noteId: resultNoteId,
|
||||
parentNoteId: note.noteId,
|
||||
notePosition: (index + 1) * 10
|
||||
notePosition: (index + 1) * 10,
|
||||
fromSearchNote: true
|
||||
}));
|
||||
|
||||
// update this note with standard (parent) branches + virtual (children) branches
|
||||
@ -267,7 +286,7 @@ class TreeCache {
|
||||
getBranch(branchId, silentNotFoundError = false) {
|
||||
if (!(branchId in this.branches)) {
|
||||
if (!silentNotFoundError) {
|
||||
console.error(`Not existing branch ${branchId}`);
|
||||
logError(`Not existing branch ${branchId}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -283,7 +302,7 @@ class TreeCache {
|
||||
const child = await this.getNote(childNoteId);
|
||||
|
||||
if (!child) {
|
||||
console.error(`Could not find branchId for parent=${parentNoteId}, child=${childNoteId} since child does not exist`);
|
||||
logError(`Could not find branchId for parent=${parentNoteId}, child=${childNoteId} since child does not exist`);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class TreeContextMenu {
|
||||
{ title: 'Search in subtree <kbd data-command="searchInSubtree"></kbd>', command: "searchInSubtree", uiIcon: "search",
|
||||
enabled: notSearch && noSelectedNotes },
|
||||
isHoisted ? null : { title: 'Hoist note <kbd data-command="toggleNoteHoisting"></kbd>', command: "toggleNoteHoisting", uiIcon: "empty", enabled: noSelectedNotes && notSearch },
|
||||
!isHoisted || !isNotRoot ? null : { title: 'Unhoist note <kbd data-command="ToggleNoteHoisting"></kbd>', command: "toggleNoteHoisting", uiIcon: "arrow-up" },
|
||||
!isHoisted || !isNotRoot ? null : { title: 'Unhoist note <kbd data-command="ToggleNoteHoisting"></kbd>', command: "toggleNoteHoisting", uiIcon: "arrow-from-bottom" },
|
||||
{ title: 'Edit branch prefix <kbd data-command="editBranchPrefix"></kbd>', command: "editBranchPrefix", uiIcon: "empty",
|
||||
enabled: isNotRoot && parentNotSearch && noSelectedNotes},
|
||||
{ title: "Advanced", uiIcon: "empty", enabled: true, items: [
|
||||
|
@ -19,8 +19,7 @@ let lastPingTs;
|
||||
let syncDataQueue = [];
|
||||
|
||||
function logError(message) {
|
||||
console.log(utils.now(), message); // needs to be separate from .trace()
|
||||
console.trace();
|
||||
console.error(utils.now(), message); // needs to be separate from .trace()
|
||||
|
||||
if (ws && ws.readyState === 1) {
|
||||
ws.send(JSON.stringify({
|
||||
@ -31,6 +30,8 @@ function logError(message) {
|
||||
}
|
||||
}
|
||||
|
||||
window.logError = logError;
|
||||
|
||||
function subscribeToMessages(messageHandler) {
|
||||
messageHandlers.push(messageHandler);
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ class ZoomService extends Component {
|
||||
|
||||
async setZoomFactorAndSave(zoomFactor) {
|
||||
if (zoomFactor >= MIN_ZOOM && zoomFactor <= MAX_ZOOM) {
|
||||
zoomFactor = Math.round(zoomFactor * 10) / 10;
|
||||
|
||||
this.setZoomFactor(zoomFactor);
|
||||
|
||||
await options.save('zoomFactor', zoomFactor);
|
||||
|
@ -162,7 +162,10 @@ const editorConfig = {
|
||||
'CodeBlock',
|
||||
'SelectAll',
|
||||
'IncludeNote',
|
||||
'CutToNote'
|
||||
'CutToNote',
|
||||
'Mathematics',
|
||||
'indentBlockShortcutPlugin',
|
||||
'removeFormatLinksPlugin'
|
||||
],
|
||||
toolbar: {
|
||||
items: []
|
||||
|
@ -5,14 +5,20 @@ const WIDGET_TPL = `
|
||||
<div class="card widget">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<button class="btn btn-sm widget-title" data-toggle="collapse" data-target="#[to be set]">
|
||||
<span class="widget-title">
|
||||
Collapsible Group Item
|
||||
</button>
|
||||
|
||||
<a class="widget-help external no-arrow bx bx-info-circle"></a>
|
||||
</span>
|
||||
|
||||
<span class="widget-header-actions"></span>
|
||||
</div>
|
||||
|
||||
<div class="widget-header-actions"></div>
|
||||
<div>
|
||||
<a class="widget-help external no-arrow bx bx-info-circle"></a>
|
||||
|
||||
<a class="widget-toggle-button no-arrow bx bx-minus"
|
||||
title="Minimize/maximize widget"
|
||||
data-toggle="collapse" data-target="#[to be set]"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="[to be set]" class="collapse body-wrapper" style="transition: none; ">
|
||||
@ -38,13 +44,18 @@ export default class CollapsibleWidget extends TabAwareWidget {
|
||||
// not using constructor name because of webpack mangling class names ...
|
||||
this.widgetName = this.widgetTitle.replace(/[^[a-zA-Z0-9]/g, "_");
|
||||
|
||||
if (!options.is(this.widgetName + 'Collapsed')) {
|
||||
this.$toggleButton = this.$widget.find('.widget-toggle-button');
|
||||
|
||||
const collapsed = options.is(this.widgetName + 'Collapsed');
|
||||
if (!collapsed) {
|
||||
this.$bodyWrapper.collapse("show");
|
||||
}
|
||||
|
||||
this.updateToggleButton(collapsed);
|
||||
|
||||
// using immediate variants of the event so that the previous collapse is not caught
|
||||
this.$bodyWrapper.on('hide.bs.collapse', () => this.saveCollapsed(true));
|
||||
this.$bodyWrapper.on('show.bs.collapse', () => this.saveCollapsed(false));
|
||||
this.$bodyWrapper.on('hide.bs.collapse', () => this.toggleCollapsed(true));
|
||||
this.$bodyWrapper.on('show.bs.collapse', () => this.toggleCollapsed(false));
|
||||
|
||||
this.$body = this.$bodyWrapper.find('.card-body');
|
||||
|
||||
@ -66,19 +77,35 @@ export default class CollapsibleWidget extends TabAwareWidget {
|
||||
}
|
||||
|
||||
this.$headerActions = this.$widget.find('.widget-header-actions');
|
||||
this.$headerActions.append(...this.headerActions);
|
||||
this.$headerActions.append(this.headerActions);
|
||||
|
||||
this.initialized = this.doRenderBody();
|
||||
|
||||
this.decorateWidget();
|
||||
}
|
||||
|
||||
saveCollapsed(collapse) {
|
||||
toggleCollapsed(collapse) {
|
||||
this.updateToggleButton(collapse);
|
||||
|
||||
options.save(this.widgetName + 'Collapsed', collapse.toString());
|
||||
|
||||
this.triggerEvent(`widgetCollapsedStateChanged`, {widgetName: this.widgetName, collapse});
|
||||
}
|
||||
|
||||
updateToggleButton(collapse) {
|
||||
if (collapse) {
|
||||
this.$toggleButton
|
||||
.addClass("bx-window")
|
||||
.removeClass("bx-minus")
|
||||
.attr("title", "Show");
|
||||
} else {
|
||||
this.$toggleButton
|
||||
.addClass("bx-minus")
|
||||
.removeClass("bx-window")
|
||||
.attr("title", "Hide");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is used to synchronize collapsed state of all the tab-cached widgets since they are all rendered
|
||||
* separately but should behave uniformly for the user.
|
||||
|
@ -24,7 +24,11 @@ export default class LinkMapWidget extends CollapsibleWidget {
|
||||
}
|
||||
|
||||
get headerActions() {
|
||||
const $showFullButton = $("<a>").append("show full").addClass('widget-header-action');
|
||||
const $showFullButton = $("<a>")
|
||||
.addClass("bx bx-map-alt")
|
||||
.addClass('widget-header-action')
|
||||
.attr('title', 'Show full link map');
|
||||
|
||||
$showFullButton.on('click', async () => {
|
||||
const linkMapDialog = await import("../../dialogs/link_map.js");
|
||||
linkMapDialog.showDialog();
|
||||
|
@ -21,7 +21,11 @@ class NoteRevisionsWidget extends CollapsibleWidget {
|
||||
}
|
||||
|
||||
get headerActions() {
|
||||
const $showFullButton = $("<a>").append("show dialog").addClass('widget-header-action');
|
||||
const $showFullButton = $("<a>")
|
||||
.addClass("bx bx-list-ul")
|
||||
.addClass('widget-header-action')
|
||||
.attr('title', 'Show Note revisions dialog');
|
||||
|
||||
$showFullButton.on('click', async () => {
|
||||
const attributesDialog = await import("../../dialogs/note_revisions.js");
|
||||
attributesDialog.showCurrentNoteRevisions(this.noteId);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user