@standardnotes/community-cdn 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/entries/com.sncommunity.advanced-checklist.json +17 -0
- package/dist/entries/com.sncommunity.bold-editor.json +17 -0
- package/dist/entries/com.sncommunity.markdown-basic.json +17 -0
- package/dist/entries/com.sncommunity.markdown-math.json +17 -0
- package/dist/entries/com.sncommunity.minimal-markdown.json +17 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/asset-manifest.json +13 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/favicon.ico +0 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/index.html +1 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/logo192.png +0 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/logo512.png +0 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/manifest.json +25 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/robots.txt +3 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/sample.ext.json +12 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/static/css/main.339b1865.css +2 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/static/css/main.339b1865.css.map +1 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/static/js/main.js +3 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/static/js/main.js.LICENSE.txt +87 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/static/js/main.js.map +1 -0
- package/dist/static/com.sncommunity.bold-editor/dist/dist.css +5 -0
- package/dist/static/com.sncommunity.bold-editor/dist/dist.min.js +2 -0
- package/dist/static/com.sncommunity.bold-editor/dist/dist.min.js.LICENSE.txt +42 -0
- package/dist/static/com.sncommunity.bold-editor/dist/filesafe-js/EncryptionWorker.js +2 -0
- package/dist/static/com.sncommunity.bold-editor/dist/filesafe-js/EncryptionWorker.js.LICENSE.txt +5 -0
- package/dist/static/com.sncommunity.bold-editor/dist/index.html +1 -0
- package/dist/static/com.sncommunity.bold-editor/dist/vendor.css +6 -0
- package/dist/static/com.sncommunity.bold-editor/dist/vendor.js +1 -0
- package/dist/static/com.sncommunity.markdown-basic/dist/dist.css +6 -0
- package/dist/static/com.sncommunity.markdown-basic/dist/dist.css.map +1 -0
- package/dist/static/com.sncommunity.markdown-basic/dist/dist.js +2 -0
- package/dist/static/com.sncommunity.markdown-basic/dist/dist.js.LICENSE.txt +32 -0
- package/dist/static/com.sncommunity.markdown-basic/dist/index.html +7 -0
- package/dist/static/com.sncommunity.markdown-math/dist/app.css +518 -0
- package/dist/static/com.sncommunity.markdown-math/dist/app.css.map +1 -0
- package/dist/static/com.sncommunity.markdown-math/dist/app.js +78 -0
- package/dist/static/com.sncommunity.markdown-math/dist/app.js.map +1 -0
- package/dist/static/com.sncommunity.markdown-math/dist/dist.css +523 -0
- package/dist/static/com.sncommunity.markdown-math/dist/dist.js +1 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/lib.js +7485 -0
- package/dist/static/com.sncommunity.markdown-math/index.html +52 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/app.css +143 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/app.css.map +1 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/app.js +115 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/app.js.map +1 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/dist.css +490 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/dist.js +11211 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/lib.js +11096 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/dialog/dialog.css +46 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/dialog/dialog.js +161 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/search.js +258 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/searchcursor.js +293 -0
- package/dist/static/com.sncommunity.minimal-markdown/index.html +23 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/asset-manifest.json +13 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/favicon.ico +0 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/index.html +1 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/logo192.png +0 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/logo512.png +0 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/manifest.json +25 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/robots.txt +3 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/sample.ext.json +12 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/static/css/main.339b1865.css +2 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/static/css/main.339b1865.css.map +1 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/static/js/main.js +3 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/static/js/main.js.LICENSE.txt +87 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/static/js/main.js.map +1 -0
- package/dist/zips/com.sncommunity.advanced-checklist/package.json +133 -0
- package/dist/zips/com.sncommunity.advanced-checklist.zip +0 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/dist.css +5 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/dist.min.js +2 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/dist.min.js.LICENSE.txt +42 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/filesafe-js/EncryptionWorker.js +2 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/filesafe-js/EncryptionWorker.js.LICENSE.txt +5 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/index.html +1 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/vendor.css +6 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/vendor.js +1 -0
- package/dist/zips/com.sncommunity.bold-editor/package.json +52 -0
- package/dist/zips/com.sncommunity.bold-editor.zip +0 -0
- package/dist/zips/com.sncommunity.markdown-basic.zip +0 -0
- package/dist/zips/com.sncommunity.markdown-math.zip +0 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/app.css +143 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/app.css.map +1 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/app.js +115 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/app.js.map +1 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/dist.css +490 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/dist.js +11211 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/lib.js +11096 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/dialog/dialog.css +46 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/dialog/dialog.js +161 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/search.js +258 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/searchcursor.js +293 -0
- package/dist/zips/com.sncommunity.minimal-markdown/index.html +23 -0
- package/dist/zips/com.sncommunity.minimal-markdown/package.json +39 -0
- package/dist/zips/com.sncommunity.minimal-markdown.zip +0 -0
- package/package.json +2 -2
- package/scripts/Compile.sh +12 -0
- package/scripts/Package.mjs +188 -0
- package/scripts/Readme.mjs +40 -0
package/dist/static/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/searchcursor.js
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
2
|
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
|
3
|
+
|
|
4
|
+
(function(mod) {
|
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
|
6
|
+
mod(require("../../lib/codemirror"))
|
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
|
8
|
+
define(["../../lib/codemirror"], mod)
|
|
9
|
+
else // Plain browser env
|
|
10
|
+
mod(CodeMirror)
|
|
11
|
+
})(function(CodeMirror) {
|
|
12
|
+
"use strict"
|
|
13
|
+
var Pos = CodeMirror.Pos
|
|
14
|
+
|
|
15
|
+
function regexpFlags(regexp) {
|
|
16
|
+
var flags = regexp.flags
|
|
17
|
+
return flags != null ? flags : (regexp.ignoreCase ? "i" : "")
|
|
18
|
+
+ (regexp.global ? "g" : "")
|
|
19
|
+
+ (regexp.multiline ? "m" : "")
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ensureFlags(regexp, flags) {
|
|
23
|
+
var current = regexpFlags(regexp), target = current
|
|
24
|
+
for (var i = 0; i < flags.length; i++) if (target.indexOf(flags.charAt(i)) == -1)
|
|
25
|
+
target += flags.charAt(i)
|
|
26
|
+
return current == target ? regexp : new RegExp(regexp.source, target)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function maybeMultiline(regexp) {
|
|
30
|
+
return /\\s|\\n|\n|\\W|\\D|\[\^/.test(regexp.source)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function searchRegexpForward(doc, regexp, start) {
|
|
34
|
+
regexp = ensureFlags(regexp, "g")
|
|
35
|
+
for (var line = start.line, ch = start.ch, last = doc.lastLine(); line <= last; line++, ch = 0) {
|
|
36
|
+
regexp.lastIndex = ch
|
|
37
|
+
var string = doc.getLine(line), match = regexp.exec(string)
|
|
38
|
+
if (match)
|
|
39
|
+
return {from: Pos(line, match.index),
|
|
40
|
+
to: Pos(line, match.index + match[0].length),
|
|
41
|
+
match: match}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function searchRegexpForwardMultiline(doc, regexp, start) {
|
|
46
|
+
if (!maybeMultiline(regexp)) return searchRegexpForward(doc, regexp, start)
|
|
47
|
+
|
|
48
|
+
regexp = ensureFlags(regexp, "gm")
|
|
49
|
+
var string, chunk = 1
|
|
50
|
+
for (var line = start.line, last = doc.lastLine(); line <= last;) {
|
|
51
|
+
// This grows the search buffer in exponentially-sized chunks
|
|
52
|
+
// between matches, so that nearby matches are fast and don't
|
|
53
|
+
// require concatenating the whole document (in case we're
|
|
54
|
+
// searching for something that has tons of matches), but at the
|
|
55
|
+
// same time, the amount of retries is limited.
|
|
56
|
+
for (var i = 0; i < chunk; i++) {
|
|
57
|
+
if (line > last) break
|
|
58
|
+
var curLine = doc.getLine(line++)
|
|
59
|
+
string = string == null ? curLine : string + "\n" + curLine
|
|
60
|
+
}
|
|
61
|
+
chunk = chunk * 2
|
|
62
|
+
regexp.lastIndex = start.ch
|
|
63
|
+
var match = regexp.exec(string)
|
|
64
|
+
if (match) {
|
|
65
|
+
var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n")
|
|
66
|
+
var startLine = start.line + before.length - 1, startCh = before[before.length - 1].length
|
|
67
|
+
return {from: Pos(startLine, startCh),
|
|
68
|
+
to: Pos(startLine + inside.length - 1,
|
|
69
|
+
inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length),
|
|
70
|
+
match: match}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function lastMatchIn(string, regexp) {
|
|
76
|
+
var cutOff = 0, match
|
|
77
|
+
for (;;) {
|
|
78
|
+
regexp.lastIndex = cutOff
|
|
79
|
+
var newMatch = regexp.exec(string)
|
|
80
|
+
if (!newMatch) return match
|
|
81
|
+
match = newMatch
|
|
82
|
+
cutOff = match.index + (match[0].length || 1)
|
|
83
|
+
if (cutOff == string.length) return match
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function searchRegexpBackward(doc, regexp, start) {
|
|
88
|
+
regexp = ensureFlags(regexp, "g")
|
|
89
|
+
for (var line = start.line, ch = start.ch, first = doc.firstLine(); line >= first; line--, ch = -1) {
|
|
90
|
+
var string = doc.getLine(line)
|
|
91
|
+
if (ch > -1) string = string.slice(0, ch)
|
|
92
|
+
var match = lastMatchIn(string, regexp)
|
|
93
|
+
if (match)
|
|
94
|
+
return {from: Pos(line, match.index),
|
|
95
|
+
to: Pos(line, match.index + match[0].length),
|
|
96
|
+
match: match}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function searchRegexpBackwardMultiline(doc, regexp, start) {
|
|
101
|
+
regexp = ensureFlags(regexp, "gm")
|
|
102
|
+
var string, chunk = 1
|
|
103
|
+
for (var line = start.line, first = doc.firstLine(); line >= first;) {
|
|
104
|
+
for (var i = 0; i < chunk; i++) {
|
|
105
|
+
var curLine = doc.getLine(line--)
|
|
106
|
+
string = string == null ? curLine.slice(0, start.ch) : curLine + "\n" + string
|
|
107
|
+
}
|
|
108
|
+
chunk *= 2
|
|
109
|
+
|
|
110
|
+
var match = lastMatchIn(string, regexp)
|
|
111
|
+
if (match) {
|
|
112
|
+
var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n")
|
|
113
|
+
var startLine = line + before.length, startCh = before[before.length - 1].length
|
|
114
|
+
return {from: Pos(startLine, startCh),
|
|
115
|
+
to: Pos(startLine + inside.length - 1,
|
|
116
|
+
inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length),
|
|
117
|
+
match: match}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
var doFold, noFold
|
|
123
|
+
if (String.prototype.normalize) {
|
|
124
|
+
doFold = function(str) { return str.normalize("NFD").toLowerCase() }
|
|
125
|
+
noFold = function(str) { return str.normalize("NFD") }
|
|
126
|
+
} else {
|
|
127
|
+
doFold = function(str) { return str.toLowerCase() }
|
|
128
|
+
noFold = function(str) { return str }
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Maps a position in a case-folded line back to a position in the original line
|
|
132
|
+
// (compensating for codepoints increasing in number during folding)
|
|
133
|
+
function adjustPos(orig, folded, pos, foldFunc) {
|
|
134
|
+
if (orig.length == folded.length) return pos
|
|
135
|
+
for (var min = 0, max = pos + Math.max(0, orig.length - folded.length);;) {
|
|
136
|
+
if (min == max) return min
|
|
137
|
+
var mid = (min + max) >> 1
|
|
138
|
+
var len = foldFunc(orig.slice(0, mid)).length
|
|
139
|
+
if (len == pos) return mid
|
|
140
|
+
else if (len > pos) max = mid
|
|
141
|
+
else min = mid + 1
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function searchStringForward(doc, query, start, caseFold) {
|
|
146
|
+
// Empty string would match anything and never progress, so we
|
|
147
|
+
// define it to match nothing instead.
|
|
148
|
+
if (!query.length) return null
|
|
149
|
+
var fold = caseFold ? doFold : noFold
|
|
150
|
+
var lines = fold(query).split(/\r|\n\r?/)
|
|
151
|
+
|
|
152
|
+
search: for (var line = start.line, ch = start.ch, last = doc.lastLine() + 1 - lines.length; line <= last; line++, ch = 0) {
|
|
153
|
+
var orig = doc.getLine(line).slice(ch), string = fold(orig)
|
|
154
|
+
if (lines.length == 1) {
|
|
155
|
+
var found = string.indexOf(lines[0])
|
|
156
|
+
if (found == -1) continue search
|
|
157
|
+
var start = adjustPos(orig, string, found, fold) + ch
|
|
158
|
+
return {from: Pos(line, adjustPos(orig, string, found, fold) + ch),
|
|
159
|
+
to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold) + ch)}
|
|
160
|
+
} else {
|
|
161
|
+
var cutFrom = string.length - lines[0].length
|
|
162
|
+
if (string.slice(cutFrom) != lines[0]) continue search
|
|
163
|
+
for (var i = 1; i < lines.length - 1; i++)
|
|
164
|
+
if (fold(doc.getLine(line + i)) != lines[i]) continue search
|
|
165
|
+
var end = doc.getLine(line + lines.length - 1), endString = fold(end), lastLine = lines[lines.length - 1]
|
|
166
|
+
if (endString.slice(0, lastLine.length) != lastLine) continue search
|
|
167
|
+
return {from: Pos(line, adjustPos(orig, string, cutFrom, fold) + ch),
|
|
168
|
+
to: Pos(line + lines.length - 1, adjustPos(end, endString, lastLine.length, fold))}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function searchStringBackward(doc, query, start, caseFold) {
|
|
174
|
+
if (!query.length) return null
|
|
175
|
+
var fold = caseFold ? doFold : noFold
|
|
176
|
+
var lines = fold(query).split(/\r|\n\r?/)
|
|
177
|
+
|
|
178
|
+
search: for (var line = start.line, ch = start.ch, first = doc.firstLine() - 1 + lines.length; line >= first; line--, ch = -1) {
|
|
179
|
+
var orig = doc.getLine(line)
|
|
180
|
+
if (ch > -1) orig = orig.slice(0, ch)
|
|
181
|
+
var string = fold(orig)
|
|
182
|
+
if (lines.length == 1) {
|
|
183
|
+
var found = string.lastIndexOf(lines[0])
|
|
184
|
+
if (found == -1) continue search
|
|
185
|
+
return {from: Pos(line, adjustPos(orig, string, found, fold)),
|
|
186
|
+
to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold))}
|
|
187
|
+
} else {
|
|
188
|
+
var lastLine = lines[lines.length - 1]
|
|
189
|
+
if (string.slice(0, lastLine.length) != lastLine) continue search
|
|
190
|
+
for (var i = 1, start = line - lines.length + 1; i < lines.length - 1; i++)
|
|
191
|
+
if (fold(doc.getLine(start + i)) != lines[i]) continue search
|
|
192
|
+
var top = doc.getLine(line + 1 - lines.length), topString = fold(top)
|
|
193
|
+
if (topString.slice(topString.length - lines[0].length) != lines[0]) continue search
|
|
194
|
+
return {from: Pos(line + 1 - lines.length, adjustPos(top, topString, top.length - lines[0].length, fold)),
|
|
195
|
+
to: Pos(line, adjustPos(orig, string, lastLine.length, fold))}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function SearchCursor(doc, query, pos, options) {
|
|
201
|
+
this.atOccurrence = false
|
|
202
|
+
this.doc = doc
|
|
203
|
+
pos = pos ? doc.clipPos(pos) : Pos(0, 0)
|
|
204
|
+
this.pos = {from: pos, to: pos}
|
|
205
|
+
|
|
206
|
+
var caseFold
|
|
207
|
+
if (typeof options == "object") {
|
|
208
|
+
caseFold = options.caseFold
|
|
209
|
+
} else { // Backwards compat for when caseFold was the 4th argument
|
|
210
|
+
caseFold = options
|
|
211
|
+
options = null
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (typeof query == "string") {
|
|
215
|
+
if (caseFold == null) caseFold = false
|
|
216
|
+
this.matches = function(reverse, pos) {
|
|
217
|
+
return (reverse ? searchStringBackward : searchStringForward)(doc, query, pos, caseFold)
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
query = ensureFlags(query, "gm")
|
|
221
|
+
if (!options || options.multiline !== false)
|
|
222
|
+
this.matches = function(reverse, pos) {
|
|
223
|
+
return (reverse ? searchRegexpBackwardMultiline : searchRegexpForwardMultiline)(doc, query, pos)
|
|
224
|
+
}
|
|
225
|
+
else
|
|
226
|
+
this.matches = function(reverse, pos) {
|
|
227
|
+
return (reverse ? searchRegexpBackward : searchRegexpForward)(doc, query, pos)
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
SearchCursor.prototype = {
|
|
233
|
+
findNext: function() {return this.find(false)},
|
|
234
|
+
findPrevious: function() {return this.find(true)},
|
|
235
|
+
|
|
236
|
+
find: function(reverse) {
|
|
237
|
+
var result = this.matches(reverse, this.doc.clipPos(reverse ? this.pos.from : this.pos.to))
|
|
238
|
+
|
|
239
|
+
// Implements weird auto-growing behavior on null-matches for
|
|
240
|
+
// backwards-compatiblity with the vim code (unfortunately)
|
|
241
|
+
while (result && CodeMirror.cmpPos(result.from, result.to) == 0) {
|
|
242
|
+
if (reverse) {
|
|
243
|
+
if (result.from.ch) result.from = Pos(result.from.line, result.from.ch - 1)
|
|
244
|
+
else if (result.from.line == this.doc.firstLine()) result = null
|
|
245
|
+
else result = this.matches(reverse, this.doc.clipPos(Pos(result.from.line - 1)))
|
|
246
|
+
} else {
|
|
247
|
+
if (result.to.ch < this.doc.getLine(result.to.line).length) result.to = Pos(result.to.line, result.to.ch + 1)
|
|
248
|
+
else if (result.to.line == this.doc.lastLine()) result = null
|
|
249
|
+
else result = this.matches(reverse, Pos(result.to.line + 1, 0))
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (result) {
|
|
254
|
+
this.pos = result
|
|
255
|
+
this.atOccurrence = true
|
|
256
|
+
return this.pos.match || true
|
|
257
|
+
} else {
|
|
258
|
+
var end = Pos(reverse ? this.doc.firstLine() : this.doc.lastLine() + 1, 0)
|
|
259
|
+
this.pos = {from: end, to: end}
|
|
260
|
+
return this.atOccurrence = false
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
from: function() {if (this.atOccurrence) return this.pos.from},
|
|
265
|
+
to: function() {if (this.atOccurrence) return this.pos.to},
|
|
266
|
+
|
|
267
|
+
replace: function(newText, origin) {
|
|
268
|
+
if (!this.atOccurrence) return
|
|
269
|
+
var lines = CodeMirror.splitLines(newText)
|
|
270
|
+
this.doc.replaceRange(lines, this.pos.from, this.pos.to, origin)
|
|
271
|
+
this.pos.to = Pos(this.pos.from.line + lines.length - 1,
|
|
272
|
+
lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0))
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
|
|
277
|
+
return new SearchCursor(this.doc, query, pos, caseFold)
|
|
278
|
+
})
|
|
279
|
+
CodeMirror.defineDocExtension("getSearchCursor", function(query, pos, caseFold) {
|
|
280
|
+
return new SearchCursor(this, query, pos, caseFold)
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
CodeMirror.defineExtension("selectMatches", function(query, caseFold) {
|
|
284
|
+
var ranges = []
|
|
285
|
+
var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold)
|
|
286
|
+
while (cur.findNext()) {
|
|
287
|
+
if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break
|
|
288
|
+
ranges.push({anchor: cur.from(), head: cur.to()})
|
|
289
|
+
}
|
|
290
|
+
if (ranges.length)
|
|
291
|
+
this.setSelections(ranges, 0)
|
|
292
|
+
})
|
|
293
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<base target="_blank">
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
|
|
7
|
+
<script src="dist/dist.js"></script>
|
|
8
|
+
|
|
9
|
+
<script src="dist/sn-codemirror-search/search.js"></script>
|
|
10
|
+
<script src="dist/sn-codemirror-search/searchcursor.js"></script>
|
|
11
|
+
<script src="dist/sn-codemirror-search/dialog/dialog.js"></script>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" media="all" href="dist/dist.css">
|
|
14
|
+
<link rel="stylesheet" media="all" href="dist/sn-codemirror-search/dialog/dialog.css">
|
|
15
|
+
</head>
|
|
16
|
+
|
|
17
|
+
<body>
|
|
18
|
+
<div id="wrapper">
|
|
19
|
+
<textarea id="code" name="code"></textarea>
|
|
20
|
+
<div>
|
|
21
|
+
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": {
|
|
3
|
+
"main.js": "./static/js/main.js",
|
|
4
|
+
"main.css": "./static/css/main.339b1865.css",
|
|
5
|
+
"index.html": "./index.html",
|
|
6
|
+
"main.js.map": "./static/js/main.js.map",
|
|
7
|
+
"main.339b1865.css.map": "./static/css/main.339b1865.css.map"
|
|
8
|
+
},
|
|
9
|
+
"entrypoints": [
|
|
10
|
+
"static/js/main.js",
|
|
11
|
+
"static/css/main.339b1865.css"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="A great way to manage short-term and long-term to-do's. You can mark tasks as completed, change their order, and edit the text naturally in place."/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="manifest" href="./manifest.json"/><title>Advanced Checklist</title><script defer="defer" src="./static/js/main.js"></script><link href="./static/css/main.339b1865.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div class="sn-component" id="root"></div></body></html>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"short_name": "Advanced Checklist",
|
|
3
|
+
"name": "Advanced Checklist",
|
|
4
|
+
"icons": [
|
|
5
|
+
{
|
|
6
|
+
"src": "favicon.ico",
|
|
7
|
+
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
+
"type": "image/x-icon"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"src": "logo192.png",
|
|
12
|
+
"type": "image/png",
|
|
13
|
+
"sizes": "192x192"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"src": "logo512.png",
|
|
17
|
+
"type": "image/png",
|
|
18
|
+
"sizes": "512x512"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"start_url": ".",
|
|
22
|
+
"display": "standalone",
|
|
23
|
+
"theme_color": "#000000",
|
|
24
|
+
"background_color": "#ffffff"
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"identifier": "org.standardnotes.advanced-checklist-dev",
|
|
3
|
+
"name": "Advanced Checklist - Dev",
|
|
4
|
+
"content_type": "SN|Component",
|
|
5
|
+
"area": "editor-editor",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"description": "A task editor with grouping functionality.",
|
|
8
|
+
"url": "http://localhost:3000/index.html",
|
|
9
|
+
"download_url": "",
|
|
10
|
+
"latest_url": "",
|
|
11
|
+
"thumbnail_url": ""
|
|
12
|
+
}
|