@standardnotes/community-cdn 0.15.5 → 0.15.6
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.standard-blue-dark-theme.json +3 -3
- package/dist/entries/com.sncommunity.standard-blue-theme.json +3 -3
- package/dist/entries/dev.randombits.excalidraw.json +3 -3
- package/dist/entries/org.standardnotes.code-editor.json +2 -2
- package/dist/entries/org.standardnotes.simple-task-editor.json +2 -2
- package/dist/packages.json +13 -13
- package/dist/static/org.standardnotes.code-editor/dist/main.css +1 -1
- package/dist/static/org.standardnotes.code-editor/dist/main.css.map +1 -1
- package/dist/static/org.standardnotes.code-editor/dist/main.js +1 -1
- package/dist/static/org.standardnotes.code-editor/dist/main.js.map +1 -1
- package/dist/static/org.standardnotes.code-editor/index.html +4 -7
- package/dist/static/org.standardnotes.simple-task-editor/dist/dist.js +1 -1
- package/dist/zips/com.sncommunity.standard-blue-dark-theme.zip +0 -0
- package/dist/zips/com.sncommunity.standard-blue-theme.zip +0 -0
- package/dist/zips/dev.randombits.excalidraw.zip +0 -0
- package/dist/zips/org.standardnotes.code-editor.zip +0 -0
- package/dist/zips/org.standardnotes.simple-task-editor.zip +0 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.15.6](https://github.com/standardnotes/plugins/compare/@standardnotes/community-cdn@0.15.5...@standardnotes/community-cdn@0.15.6) (2025-06-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @standardnotes/community-cdn
|
|
9
|
+
|
|
6
10
|
## [0.15.5](https://github.com/standardnotes/plugins/compare/@standardnotes/community-cdn@0.15.4...@standardnotes/community-cdn@0.15.5) (2024-06-12)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @standardnotes/community-cdn
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"url": "https://standardnotes.github.io/plugins/cdn/dist/static/com.sncommunity.standard-blue-dark-theme/dist/dist.css",
|
|
10
10
|
"download_url": "https://standardnotes.github.io/plugins/cdn/dist/zips/com.sncommunity.standard-blue-dark-theme.zip",
|
|
11
11
|
"latest_url": "https://standardnotes.github.io/plugins/cdn/dist/entries/com.sncommunity.standard-blue-dark-theme.json",
|
|
12
|
-
"publisher": "
|
|
12
|
+
"publisher": "Passkeys",
|
|
13
13
|
"description": "A dark blue theme for Standard Notes.",
|
|
14
|
-
"base64Hash": "
|
|
15
|
-
"binaryHash": "
|
|
14
|
+
"base64Hash": "5518404f27a7782d31d03bb209694976da68ad813b92d4bf0609c4eacfdd263e",
|
|
15
|
+
"binaryHash": "c10bd0156a95951a123d5a5dad2849b27b018ecb659a511198496ee3dd5efb45"
|
|
16
16
|
}
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"url": "https://standardnotes.github.io/plugins/cdn/dist/static/com.sncommunity.standard-blue-theme/dist/dist.css",
|
|
10
10
|
"download_url": "https://standardnotes.github.io/plugins/cdn/dist/zips/com.sncommunity.standard-blue-theme.zip",
|
|
11
11
|
"latest_url": "https://standardnotes.github.io/plugins/cdn/dist/entries/com.sncommunity.standard-blue-theme.json",
|
|
12
|
-
"publisher": "
|
|
12
|
+
"publisher": "Passkeys",
|
|
13
13
|
"description": "A light blue theme for Standard Notes.",
|
|
14
|
-
"base64Hash": "
|
|
15
|
-
"binaryHash": "
|
|
14
|
+
"base64Hash": "b56c8f3c3516c32bf0039399d9aadeaea4fbc14b221f2972d0470fc6f1551ee7",
|
|
15
|
+
"binaryHash": "e265925f0c38d2554353f403b26276669c7969d27c7afbe2502dae82b28814b2"
|
|
16
16
|
}
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"file_type": "json",
|
|
7
7
|
"showInGallery": true,
|
|
8
8
|
"identifier": "dev.randombits.excalidraw",
|
|
9
|
-
"version": "1.2.
|
|
9
|
+
"version": "1.2.1",
|
|
10
10
|
"url": "https://standardnotes.github.io/plugins/cdn/dist/static/dev.randombits.excalidraw/dist/index.html",
|
|
11
11
|
"download_url": "https://standardnotes.github.io/plugins/cdn/dist/zips/dev.randombits.excalidraw.zip",
|
|
12
12
|
"latest_url": "https://standardnotes.github.io/plugins/cdn/dist/entries/dev.randombits.excalidraw.json",
|
|
13
13
|
"publisher": "Matthew Nienow",
|
|
14
14
|
"description": "A virtual whiteboard editor, with a hand-drawn style. Powered by Excalidraw.",
|
|
15
|
-
"base64Hash": "
|
|
16
|
-
"binaryHash": "
|
|
15
|
+
"base64Hash": "f48426222565a0900d6a9363092c79f1625daef1f481edbaa045bfca7038b253",
|
|
16
|
+
"binaryHash": "bfe85f834339ccf89ed640268dda879c6bff6dc8ebce4b78e8ac4e7eef3b6199"
|
|
17
17
|
}
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
"latest_url": "https://standardnotes.github.io/plugins/cdn/dist/entries/org.standardnotes.code-editor.json",
|
|
15
15
|
"publisher": "Standard Notes Community",
|
|
16
16
|
"description": "Syntax highlighting and convenient keyboard shortcuts for over 120 programming languages. Ideal for code snippets and procedures.",
|
|
17
|
-
"base64Hash": "
|
|
18
|
-
"binaryHash": "
|
|
17
|
+
"base64Hash": "7286fa130f7057a0a2e4ec5f22f75f3f00fb6dbb9e94008f4f3f98cd8bb75e94",
|
|
18
|
+
"binaryHash": "5353cd4de82b107ecdd242abd5459e0b52adf1f5322c31b4752bf56e71213b5a"
|
|
19
19
|
}
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
"latest_url": "https://standardnotes.github.io/plugins/cdn/dist/entries/org.standardnotes.simple-task-editor.json",
|
|
15
15
|
"publisher": "Standard Notes Community",
|
|
16
16
|
"description": "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.",
|
|
17
|
-
"base64Hash": "
|
|
18
|
-
"binaryHash": "
|
|
17
|
+
"base64Hash": "f999a54396e2d0d3f94011f10bc7b79484a24921053bc843875f7f8ac2d80015",
|
|
18
|
+
"binaryHash": "b559a1276847ed9959545b8ecd70c4a8314945da33158b6d79369983e48ac59f"
|
|
19
19
|
}
|
package/dist/packages.json
CHANGED
|
@@ -197,8 +197,8 @@
|
|
|
197
197
|
"latest_url": "https://standardnotes.github.io/plugins/cdn/dist/entries/org.standardnotes.simple-task-editor.json",
|
|
198
198
|
"publisher": "Standard Notes Community",
|
|
199
199
|
"description": "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.",
|
|
200
|
-
"base64Hash": "
|
|
201
|
-
"binaryHash": "
|
|
200
|
+
"base64Hash": "f999a54396e2d0d3f94011f10bc7b79484a24921053bc843875f7f8ac2d80015",
|
|
201
|
+
"binaryHash": "b559a1276847ed9959545b8ecd70c4a8314945da33158b6d79369983e48ac59f"
|
|
202
202
|
},
|
|
203
203
|
"org.standardnotes.code-editor": {
|
|
204
204
|
"name": "Code",
|
|
@@ -216,8 +216,8 @@
|
|
|
216
216
|
"latest_url": "https://standardnotes.github.io/plugins/cdn/dist/entries/org.standardnotes.code-editor.json",
|
|
217
217
|
"publisher": "Standard Notes Community",
|
|
218
218
|
"description": "Syntax highlighting and convenient keyboard shortcuts for over 120 programming languages. Ideal for code snippets and procedures.",
|
|
219
|
-
"base64Hash": "
|
|
220
|
-
"binaryHash": "
|
|
219
|
+
"base64Hash": "7286fa130f7057a0a2e4ec5f22f75f3f00fb6dbb9e94008f4f3f98cd8bb75e94",
|
|
220
|
+
"binaryHash": "5353cd4de82b107ecdd242abd5459e0b52adf1f5322c31b4752bf56e71213b5a"
|
|
221
221
|
},
|
|
222
222
|
"com.sncommunity.standard-blue-dark-theme": {
|
|
223
223
|
"name": "Standard Blue Dark",
|
|
@@ -230,10 +230,10 @@
|
|
|
230
230
|
"url": "https://standardnotes.github.io/plugins/cdn/dist/static/com.sncommunity.standard-blue-dark-theme/dist/dist.css",
|
|
231
231
|
"download_url": "https://standardnotes.github.io/plugins/cdn/dist/zips/com.sncommunity.standard-blue-dark-theme.zip",
|
|
232
232
|
"latest_url": "https://standardnotes.github.io/plugins/cdn/dist/entries/com.sncommunity.standard-blue-dark-theme.json",
|
|
233
|
-
"publisher": "
|
|
233
|
+
"publisher": "Passkeys",
|
|
234
234
|
"description": "A dark blue theme for Standard Notes.",
|
|
235
|
-
"base64Hash": "
|
|
236
|
-
"binaryHash": "
|
|
235
|
+
"base64Hash": "5518404f27a7782d31d03bb209694976da68ad813b92d4bf0609c4eacfdd263e",
|
|
236
|
+
"binaryHash": "c10bd0156a95951a123d5a5dad2849b27b018ecb659a511198496ee3dd5efb45"
|
|
237
237
|
},
|
|
238
238
|
"com.sncommunity.markdown-monospace": {
|
|
239
239
|
"name": "Markdown Monospace",
|
|
@@ -260,14 +260,14 @@
|
|
|
260
260
|
"file_type": "json",
|
|
261
261
|
"showInGallery": true,
|
|
262
262
|
"identifier": "dev.randombits.excalidraw",
|
|
263
|
-
"version": "1.2.
|
|
263
|
+
"version": "1.2.1",
|
|
264
264
|
"url": "https://standardnotes.github.io/plugins/cdn/dist/static/dev.randombits.excalidraw/dist/index.html",
|
|
265
265
|
"download_url": "https://standardnotes.github.io/plugins/cdn/dist/zips/dev.randombits.excalidraw.zip",
|
|
266
266
|
"latest_url": "https://standardnotes.github.io/plugins/cdn/dist/entries/dev.randombits.excalidraw.json",
|
|
267
267
|
"publisher": "Matthew Nienow",
|
|
268
268
|
"description": "A virtual whiteboard editor, with a hand-drawn style. Powered by Excalidraw.",
|
|
269
|
-
"base64Hash": "
|
|
270
|
-
"binaryHash": "
|
|
269
|
+
"base64Hash": "f48426222565a0900d6a9363092c79f1625daef1f481edbaa045bfca7038b253",
|
|
270
|
+
"binaryHash": "bfe85f834339ccf89ed640268dda879c6bff6dc8ebce4b78e8ac4e7eef3b6199"
|
|
271
271
|
},
|
|
272
272
|
"com.sncommunity.standard-blue-theme": {
|
|
273
273
|
"name": "Standard Blue",
|
|
@@ -280,9 +280,9 @@
|
|
|
280
280
|
"url": "https://standardnotes.github.io/plugins/cdn/dist/static/com.sncommunity.standard-blue-theme/dist/dist.css",
|
|
281
281
|
"download_url": "https://standardnotes.github.io/plugins/cdn/dist/zips/com.sncommunity.standard-blue-theme.zip",
|
|
282
282
|
"latest_url": "https://standardnotes.github.io/plugins/cdn/dist/entries/com.sncommunity.standard-blue-theme.json",
|
|
283
|
-
"publisher": "
|
|
283
|
+
"publisher": "Passkeys",
|
|
284
284
|
"description": "A light blue theme for Standard Notes.",
|
|
285
|
-
"base64Hash": "
|
|
286
|
-
"binaryHash": "
|
|
285
|
+
"base64Hash": "b56c8f3c3516c32bf0039399d9aadeaea4fbc14b221f2972d0470fc6f1551ee7",
|
|
286
|
+
"binaryHash": "e265925f0c38d2554353f403b26276669c7969d27c7afbe2502dae82b28814b2"
|
|
287
287
|
}
|
|
288
288
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
body,html{font-family:sans-serif;height:100%;margin:0;font-size:var(--sn-stylekit-base-font-size)}.wrapper{display:flex;flex-direction:column;position:relative;height:100%;overflow-x:hidden}.CodeMirror{background-color:var(--sn-stylekit-editor-background-color) !important;color:var(--sn-stylekit-editor-foreground-color) !important;border:0 !important;font-family:var(--sn-stylekit-monospace-font);-webkit-overflow-scrolling:touch;font-size:calc(var(--sn-stylekit-font-size-editor) - .1rem);flex:1 1 auto;width:100%;height:100%;resize:none}.CodeMirror .cm-header{color:var(--sn-stylekit-editor-foreground-color)}.CodeMirror .cm-formatting-header,.CodeMirror .cm-formatting-strong,.CodeMirror .cm-formatting-em{opacity:.2}.CodeMirror .cm-variable,.CodeMirror .cm-variable-1,.CodeMirror .cm-variable-2,.CodeMirror .cm-variable-3,.CodeMirror .cm-string-2{color:var(--sn-stylekit-info-color) !important}.CodeMirror .cm-variable.CodeMirror-selectedtext,.CodeMirror .cm-variable-1.CodeMirror-selectedtext,.CodeMirror .cm-variable-2.CodeMirror-selectedtext,.CodeMirror .cm-variable-3.CodeMirror-selectedtext,.CodeMirror .cm-string-2.CodeMirror-selectedtext{color:var(--sn-stylekit-info-contrast-color) !important;background:rgba(0,0,0,0)}.CodeMirror .cm-qualifier,.CodeMirror .cm-meta{color:var(--sn-stylekit-neutral-color) !important}.CodeMirror .cm-error{color:var(--sn-stylekit-danger-color) !important}.CodeMirror .cm-def,.CodeMirror .cm-atom{color:var(--sn-stylekit-success-color)}.CodeMirror .CodeMirror-linenumber{color:var(--sn-stylekit-neutral-color) !important;opacity:.5}.CodeMirror-cursor{border-color:var(--sn-stylekit-info-color) !important}.CodeMirror-cursors{z-index:10 !important}.CodeMirror-selected{background:var(--sn-stylekit-info-color) !important}.CodeMirror-gutters{background-color:var(--sn-stylekit-background-color) !important;color:var(--sn-stylekit-editor-foreground-color) !important;border-color:var(--sn-stylekit-border-color) !important}.cm-header-1{font-size:150%}.cm-header-2{font-size:130%}.cm-header-3{font-size:120%}.cm-header-4{font-size:110%}.cm-header-5{font-size:100%}.cm-header-6{font-size:90%}.CodeMirror .cm-quote{color:var(--sn-stylekit-foreground-color);opacity:.6}.cm-fat-cursor .CodeMirror-line>span[role=presentation]{caret-color:rgba(0,0,0,0)}
|
|
1
|
+
body,html{font-family:sans-serif;height:100%;margin:0;font-size:var(--sn-stylekit-base-font-size)}.wrapper{display:flex;flex-direction:column;position:relative;height:100%;overflow-x:hidden}.CodeMirror{background-color:var(--sn-stylekit-editor-background-color) !important;color:var(--sn-stylekit-editor-foreground-color) !important;border:0 !important;font-family:var(--sn-stylekit-monospace-font);-webkit-overflow-scrolling:touch;font-size:calc(var(--sn-stylekit-font-size-editor) - .1rem);flex:1 1 auto;width:100%;height:100%;resize:none}.CodeMirror .cm-header{color:var(--sn-stylekit-editor-foreground-color)}.CodeMirror .cm-formatting-header,.CodeMirror .cm-formatting-strong,.CodeMirror .cm-formatting-em{opacity:.2}.CodeMirror .cm-variable,.CodeMirror .cm-variable-1,.CodeMirror .cm-variable-2,.CodeMirror .cm-variable-3,.CodeMirror .cm-string-2{color:var(--sn-stylekit-info-color) !important}.CodeMirror .cm-variable.CodeMirror-selectedtext,.CodeMirror .cm-variable-1.CodeMirror-selectedtext,.CodeMirror .cm-variable-2.CodeMirror-selectedtext,.CodeMirror .cm-variable-3.CodeMirror-selectedtext,.CodeMirror .cm-string-2.CodeMirror-selectedtext{color:var(--sn-stylekit-info-contrast-color) !important;background:rgba(0,0,0,0)}.CodeMirror .cm-qualifier,.CodeMirror .cm-meta{color:var(--sn-stylekit-neutral-color) !important}.CodeMirror .cm-error{color:var(--sn-stylekit-danger-color) !important}.CodeMirror .cm-def,.CodeMirror .cm-atom{color:var(--sn-stylekit-success-color)}.CodeMirror .CodeMirror-linenumber{color:var(--sn-stylekit-neutral-color) !important;opacity:.5}.CodeMirror-cursor{border-color:var(--sn-stylekit-info-color) !important}.CodeMirror-cursors{z-index:10 !important}.CodeMirror-selected{background:var(--sn-stylekit-info-color) !important}.CodeMirror-gutters{background-color:var(--sn-stylekit-background-color) !important;color:var(--sn-stylekit-editor-foreground-color) !important;border-color:var(--sn-stylekit-border-color) !important}.cm-header-1{font-size:150%}.cm-header-2{font-size:130%}.cm-header-3{font-size:120%}.cm-header-4{font-size:110%}.cm-header-5{font-size:100%}.cm-header-6{font-size:90%}.CodeMirror .cm-quote{color:var(--sn-stylekit-foreground-color);opacity:.6}.cm-fat-cursor .CodeMirror-line>span[role=presentation]{caret-color:rgba(0,0,0,0)}#bar{width:inherit}
|
|
2
2
|
|
|
3
3
|
/*# sourceMappingURL=main.css.map*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.css","mappings":"AAAA,UACE,uBACA,YACA,SACA,4CAGF,SACE,aACA,sBACA,kBACA,YAGA,kBAGF,YACE,uEACA,4DACA,oBACA,8CACA,iCAGA,4DAEA,cACA,WACA,YACA,YAEA,uBACE,iDAIF,kGACE,WAGF,mIACE,+CAEA,2PACE,wDACA,yBAIJ,+CACE,kDAGF,sBACE,iDAOF,yCACE,uCAGF,mCACE,kDACA,WAIJ,mBACE,sDAGF,oBACE,sBAGF,qBACE,oDAGF,oBACE,gEACA,4DACA,wDAGF,4BACA,4BACA,4BACA,4BACA,4BACA,2BAEA,sBACE,0CACA,WAGF,wDACE,
|
|
1
|
+
{"version":3,"file":"main.css","mappings":"AAAA,UACE,uBACA,YACA,SACA,4CAGF,SACE,aACA,sBACA,kBACA,YAGA,kBAGF,YACE,uEACA,4DACA,oBACA,8CACA,iCAGA,4DAEA,cACA,WACA,YACA,YAEA,uBACE,iDAIF,kGACE,WAGF,mIACE,+CAEA,2PACE,wDACA,yBAIJ,+CACE,kDAGF,sBACE,iDAOF,yCACE,uCAGF,mCACE,kDACA,WAIJ,mBACE,sDAGF,oBACE,sBAGF,qBACE,oDAGF,oBACE,gEACA,4DACA,wDAGF,4BACA,4BACA,4BACA,4BACA,4BACA,2BAEA,sBACE,0CACA,WAGF,wDACE,0BAGF,KACE,c","sources":["webpack://@standardnotes/classic-code-editor/./src/main.scss"],"sourcesContent":["body, html {\n font-family: sans-serif;\n height: 100%;\n margin: 0;\n font-size: var(--sn-stylekit-base-font-size);\n}\n\n.wrapper {\n display: flex;\n flex-direction: column;\n position: relative;\n height: 100%;\n\n // Fixes unnecessary horizontal scrolling on Windows\n overflow-x: hidden;\n}\n\n.CodeMirror {\n background-color: var(--sn-stylekit-editor-background-color) !important;\n color: var(--sn-stylekit-editor-foreground-color) !important;\n border: 0 !important;\n font-family: var(--sn-stylekit-monospace-font);\n -webkit-overflow-scrolling: touch;\n\n // code doesn't look good at normal text size, better to be a bit smaller\n font-size: calc(var(--sn-stylekit-font-size-editor) - 0.1rem);\n\n flex: 1 1 auto;\n width: 100%;\n height: 100%;\n resize: none;\n\n .cm-header {\n color: var(--sn-stylekit-editor-foreground-color);\n }\n\n // Faded Markdown syntax\n .cm-formatting-header, .cm-formatting-strong, .cm-formatting-em {\n opacity: 0.2;\n }\n\n .cm-variable, .cm-variable-1, .cm-variable-2, .cm-variable-3, .cm-string-2 {\n color: var(--sn-stylekit-info-color) !important;\n\n &.CodeMirror-selectedtext {\n color: var(--sn-stylekit-info-contrast-color) !important;\n background: transparent;\n }\n }\n\n .cm-qualifier, .cm-meta {\n color: var(--sn-stylekit-neutral-color) !important;\n }\n\n .cm-error {\n color: var(--sn-stylekit-danger-color) !important;\n }\n\n .cm-property {\n\n }\n\n .cm-def, .cm-atom {\n color: var(--sn-stylekit-success-color);\n }\n\n .CodeMirror-linenumber {\n color: var(--sn-stylekit-neutral-color) !important;\n opacity: 0.5;\n }\n}\n\n.CodeMirror-cursor {\n border-color: var(--sn-stylekit-info-color) !important;\n}\n\n.CodeMirror-cursors {\n z-index: 10 !important; // In Markdown mode, cursor is hidden behind code blocks\n}\n\n.CodeMirror-selected {\n background: var(--sn-stylekit-info-color) !important;\n}\n\n.CodeMirror-gutters {\n background-color: var(--sn-stylekit-background-color) !important;\n color: var(--sn-stylekit-editor-foreground-color) !important;\n border-color: var(--sn-stylekit-border-color) !important;\n}\n\n.cm-header-1 { font-size: 150%; }\n.cm-header-2 { font-size: 130%; }\n.cm-header-3 { font-size: 120%; }\n.cm-header-4 { font-size: 110%; }\n.cm-header-5 { font-size: 100%; }\n.cm-header-6 { font-size: 90%; }\n\n.CodeMirror .cm-quote {\n color: var(--sn-stylekit-foreground-color);\n opacity: 0.6;\n}\n\n.cm-fat-cursor .CodeMirror-line > span[role=\"presentation\"] {\n caret-color: transparent;\n}\n\n#bar {\n width: inherit;\n}\n"],"names":[],"sourceRoot":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
document.addEventListener("DOMContentLoaded",(function(){const e=CodeMirror.modeInfo.reduce((function(e,t){return e[t.mode]?e[t.mode].push(t):e[t.mode]=[t],e}),{}),t=CodeMirror.modeInfo.reduce((function(e,t){return e[t.name]={mode:t.mode,mime:t.mime},e}),{}),n=Object.keys(t);let o,i,a,
|
|
1
|
+
CodeMirror.modeURL="dist/codemirror/mode/%N/%N.js",document.addEventListener("DOMContentLoaded",(function(){const e=CodeMirror.modeInfo.reduce((function(e,t){return e[t.mode]?e[t.mode].push(t):e[t.mode]=[t],e}),{}),t=CodeMirror.modeInfo.reduce((function(e,t){return e[t.name]={mode:t.mode,mime:t.mime},e}),{}),n=Object.keys(t);let o,d,i,a,m,c,r,s=!1,l=!0;function u(){if(d){let e=d;o.saveItemWithPresave(e,(()=>{a=c.getValue(),e.content.text=a,e.clientData=i,e.content.preview_plain=null,e.content.preview_html=null}))}}function f(o){if(!o)return;const d=function(n){const o=function(e){return e?{name:e.name,mode:e.mode,mime:e.mime}:null},d=/.+\.([^.]+)$/.exec(n),i=/\//.test(n);if(d)return o(CodeMirror.findModeByExtension(d[1]));if(i)return o(CodeMirror.findModeByMIME(i[1]));if(t[n])return{name:n,mode:t[n].mode,mime:t[n].mime};if(e[n]){const t=e[n][0];return{name:t.name,mode:t.mode,mime:t.mime}}return{name:n,mode:n,mime:n}}(o);d?(c.setOption("mode",d.mime),CodeMirror.autoLoadMode(c,d.mode),i&&(i.mode=d.name),document.getElementById("language-select").selectedIndex=n.indexOf(d.name)):console.error("Could not find a mode corresponding to "+o)}window.setKeyMap=function(e){c.setOption("keyMap",e),function(e){const t=document.getElementById("toggle-vim-mode-button"),n="vim"===e?"Disable":"Enable",o="vim"===e?"danger":"success";t.innerHTML=`${n} Vim mode`,t.classList.remove("danger"),t.classList.remove("success"),t.classList.add(o)}(e)},document.getElementById("language-select").addEventListener("change",(function(){f(n[r.selectedIndex]),u()})),document.getElementById("default-label").addEventListener("click",(function(){const e=n[r.selectedIndex];o.setComponentDataValueForKey("language",e);const t=document.getElementById("default-label"),d=t.innerHTML;t.innerHTML="Success",t.classList.add("success"),setTimeout((function(){t.classList.remove("success"),t.innerHTML=d}),750)})),document.getElementById("toggle-vim-mode-button").addEventListener("click",(function(){let e;e="default"===(o.getComponentDataValueForKey("keyMap")??"default")?"vim":"default",window.setKeyMap(e),o.setComponentDataValueForKey("keyMap",e)})),o=new ComponentRelay({targetWindow:window,onReady:()=>{const e=o.platform;e&&document.body.classList.add(e),function(){CodeMirror.commands.save=function(){u()},c=CodeMirror.fromTextArea(document.getElementById("code"),{extraKeys:{"Alt-F":"findPersistent"},lineNumbers:!0,styleSelectedText:!0,lineWrapping:!0,inputStyle:"mobile"===(o.environment??"web")?"textarea":"contenteditable"}),c.setSize("100%","100%"),function(){r=document.getElementById("language-select");for(let e=0;e<n.length;e++){const t=document.createElement("option");t.value=e,t.innerHTML=n[e],r.appendChild(t)}}(),c.on("change",(function(){s||u()}));c.on("cursorActivity",(function(e){"mobile"===o.environment&&(e=>{setTimeout((()=>e.scrollIntoView()),200)})(e)}));const e=o.getComponentDataValueForKey("keyMap")??"default";window.setKeyMap(e)}()},handleRequestForContentHeight:()=>{const e=document.getElementsByClassName("CodeMirror-code")[0]?.scrollHeight;return 50+e}}),o.streamContextItem((e=>{!function(e){if(e.uuid!==m&&(a=null,l=!0,m=e.uuid),d=e,e.isMetadataUpdate)return;i=e.clientData;let t=i.mode;t||(t=o.getComponentDataValueForKey("language")??"JavaScript"),f(t),c&&(e.content.text!==a&&(s=!0,c.getDoc().setValue(d.content.text),s=!1),l&&(l=!1,c.getDoc().clearHistory()),c.setOption("spellcheck",d.content.spellcheck))}(e)}))}));
|
|
2
2
|
//# sourceMappingURL=main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","mappings":"AAAAA,SAASC,iBAAiB,oBAAoB,WAC5C,MAAMC,EAAiBC,WAAWC,SAASC,QAAO,SAAUC,EAAKC,GAM/D,OALID,EAAIC,EAAEC,MACRF,EAAIC,EAAEC,MAAMC,KAAKF,GAEjBD,EAAIC,EAAEC,MAAQ,CAACD,GAEVD,CACT,GAAG,CAAC,GAEEI,EAAwBP,WAAWC,SAASC,QAAO,SAAUC,EAAKC,GAEtE,OADAD,EAAIC,EAAEI,MAAQ,CAAEH,KAAMD,EAAEC,KAAMI,KAAML,EAAEK,MAC/BN,CACT,GA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Content":["document.addEventListener('DOMContentLoaded', function () {\n const modeByModeMode = CodeMirror.modeInfo.reduce(function (acc, m) {\n if (acc[m.mode]) {\n acc[m.mode].push(m)\n } else {\n acc[m.mode] = [m]\n }\n return acc\n }, {})\n\n const modeModeAndMimeByName = CodeMirror.modeInfo.reduce(function (acc, m) {\n acc[m.name] = { mode: m.mode, mime: m.mime }\n return acc\n }, {})\n\n const modes = Object.keys(modeModeAndMimeByName)\n\n let componentRelay\n let workingNote, clientData\n let lastValue, lastUUID\n let editor, select\n let ignoreTextChange = false\n let initialLoad = true\n\n function loadComponentRelay() {\n componentRelay = new ComponentRelay({\n targetWindow: window,\n onReady: () => {\n const platform = componentRelay.platform\n if (platform) {\n document.body.classList.add(platform)\n }\n loadEditor()\n },\n handleRequestForContentHeight: () => {\n const baseHeight = 50\n const scrollHeight = document.getElementsByClassName('CodeMirror-code')[0]?.scrollHeight\n return baseHeight + scrollHeight\n },\n })\n\n componentRelay.streamContextItem((note) => {\n onReceivedNote(note)\n })\n }\n\n function saveNote() {\n if (workingNote) {\n // Be sure to capture this object as a variable, as this.note may be reassigned in `streamContextItem`, so by the time\n // you modify it in the presave block, it may not be the same object anymore, so the presave values will not be applied to\n // the right object, and it will save incorrectly.\n let note = workingNote\n\n componentRelay.saveItemWithPresave(note, () => {\n lastValue = editor.getValue()\n note.content.text = lastValue\n note.clientData = clientData\n\n note.content.preview_plain = null\n note.content.preview_html = null\n })\n }\n }\n\n function onReceivedNote(note) {\n if (note.uuid !== lastUUID) {\n // Note changed, reset last values\n lastValue = null\n initialLoad = true\n lastUUID = note.uuid\n }\n\n workingNote = note\n // Only update UI on non-metadata updates.\n if (note.isMetadataUpdate) {\n return\n }\n\n clientData = note.clientData\n let mode = clientData.mode\n\n if (!mode) {\n // Assign editor's default mode from component settings\n mode = componentRelay.getComponentDataValueForKey('language') ?? 'JavaScript'\n }\n\n changeMode(mode)\n\n if (editor) {\n if (note.content.text !== lastValue) {\n ignoreTextChange = true\n editor.getDoc().setValue(workingNote.content.text)\n ignoreTextChange = false\n }\n\n if (initialLoad) {\n initialLoad = false\n editor.getDoc().clearHistory()\n }\n\n editor.setOption('spellcheck', workingNote.content.spellcheck)\n }\n }\n\n function loadEditor() {\n // Handler for the save command that is mapped to the :w (write) Vim key binding.\n CodeMirror.commands.save = function () {\n saveNote()\n }\n editor = CodeMirror.fromTextArea(document.getElementById('code'), {\n extraKeys: {\n 'Alt-F': 'findPersistent',\n },\n lineNumbers: true,\n styleSelectedText: true,\n lineWrapping: true,\n inputStyle: getInputStyleForEnvironment(),\n })\n editor.setSize('100%', '100%')\n\n createSelectElements()\n\n editor.on('change', function () {\n if (ignoreTextChange) {\n return\n }\n saveNote()\n })\n\n /**\n * Scrolls the cursor into view, so the soft keyboard on mobile devices\n * doesn't overlap the cursor. A short delay is added to prevent scrolling\n * before the keyboard is shown.\n */\n const scrollCursorIntoView = (editor) => {\n setTimeout(() => editor.scrollIntoView(), 200)\n }\n\n editor.on('cursorActivity', function (editor) {\n if (componentRelay.environment !== 'mobile') {\n return\n }\n scrollCursorIntoView(editor)\n })\n\n const initialKeyMap = componentRelay.getComponentDataValueForKey('keyMap') ?? 'default'\n window.setKeyMap(initialKeyMap)\n }\n\n function createSelectElements() {\n select = document.getElementById('language-select')\n for (let index = 0; index < modes.length; index++) {\n const option = document.createElement('option')\n option.value = index\n option.innerHTML = modes[index]\n select.appendChild(option)\n }\n }\n\n // Editor Modes\n window.setKeyMap = function (keymap) {\n editor.setOption('keyMap', keymap)\n updateVimStatus(keymap)\n }\n\n window.onLanguageSelect = function () {\n const language = modes[select.selectedIndex]\n changeMode(language)\n saveNote()\n }\n\n window.setDefaultLanguage = function () {\n const language = modes[select.selectedIndex]\n\n // assign default language for this editor when entering notes\n componentRelay.setComponentDataValueForKey('language', language)\n\n // show a confirmation message\n const message = document.getElementById('default-label')\n const original = message.innerHTML\n message.innerHTML = 'Success'\n message.classList.add('success')\n\n setTimeout(function () {\n message.classList.remove('success')\n message.innerHTML = original\n }, 750)\n }\n\n function inputModeToMode(inputMode) {\n const convertCodeMirrorMode = function (codeMirrorMode) {\n if (codeMirrorMode) {\n return {\n name: codeMirrorMode.name,\n mode: codeMirrorMode.mode,\n mime: codeMirrorMode.mime,\n }\n } else {\n return null\n }\n }\n\n const extension = /.+\\.([^.]+)$/.exec(inputMode)\n const mime = /\\//.test(inputMode)\n\n if (extension) {\n return convertCodeMirrorMode(CodeMirror.findModeByExtension(extension[1]))\n } else if (mime) {\n return convertCodeMirrorMode(CodeMirror.findModeByMIME(mime[1]))\n } else if (modeModeAndMimeByName[inputMode]) {\n return {\n name: inputMode,\n mode: modeModeAndMimeByName[inputMode].mode,\n mime: modeModeAndMimeByName[inputMode].mime,\n }\n } else if (modeByModeMode[inputMode]) {\n const firstMode = modeByModeMode[inputMode][0]\n return {\n name: firstMode.name,\n mode: firstMode.mode,\n mime: firstMode.mime,\n }\n } else {\n return {\n name: inputMode,\n mode: inputMode,\n mime: inputMode,\n }\n }\n }\n\n function changeMode(inputMode) {\n if (!inputMode) {\n return\n }\n\n const mode = inputModeToMode(inputMode)\n\n if (mode) {\n editor.setOption('mode', mode.mime)\n CodeMirror.autoLoadMode(editor, mode.mode)\n if (clientData) {\n clientData.mode = mode.name\n }\n document.getElementById('language-select').selectedIndex = modes.indexOf(mode.name)\n } else {\n console.error('Could not find a mode corresponding to ' + inputMode)\n }\n }\n\n function updateVimStatus(keyMap) {\n const toggleButton = document.getElementById('toggle-vim-mode-button')\n\n const newAction = keyMap === 'vim' ? 'Disable' : 'Enable'\n const buttonClass = keyMap === 'vim' ? 'danger' : 'success'\n\n toggleButton.innerHTML = `${newAction} Vim mode`\n toggleButton.classList.remove('danger')\n toggleButton.classList.remove('success')\n toggleButton.classList.add(buttonClass)\n }\n\n window.toggleVimMode = function () {\n let newKeyMap\n\n const currentKeyMap = componentRelay.getComponentDataValueForKey('keyMap') ?? 'default'\n if (currentKeyMap === 'default') {\n newKeyMap = 'vim'\n } else {\n newKeyMap = 'default'\n }\n\n window.setKeyMap(newKeyMap)\n componentRelay.setComponentDataValueForKey('keyMap', newKeyMap)\n }\n\n function getInputStyleForEnvironment() {\n const environment = componentRelay.environment ?? 'web'\n return environment === 'mobile' ? 'textarea' : 'contenteditable'\n }\n\n loadComponentRelay()\n})\n"],"names":["document","addEventListener","modeByModeMode","CodeMirror","modeInfo","reduce","acc","m","mode","push","modeModeAndMimeByName","name","mime","modes","Object","keys","componentRelay","workingNote","clientData","lastValue","lastUUID","editor","select","ignoreTextChange","initialLoad","saveNote","note","saveItemWithPresave","getValue","content","text","preview_plain","preview_html","changeMode","inputMode","convertCodeMirrorMode","codeMirrorMode","extension","exec","test","findModeByExtension","findModeByMIME","firstMode","inputModeToMode","setOption","autoLoadMode","getElementById","selectedIndex","indexOf","console","error","window","setKeyMap","keymap","keyMap","toggleButton","newAction","buttonClass","innerHTML","classList","remove","add","updateVimStatus","onLanguageSelect","setDefaultLanguage","language","setComponentDataValueForKey","message","original","setTimeout","toggleVimMode","newKeyMap","getComponentDataValueForKey","ComponentRelay","targetWindow","onReady","platform","body","commands","save","fromTextArea","extraKeys","lineNumbers","styleSelectedText","lineWrapping","inputStyle","environment","setSize","index","length","option","createElement","value","appendChild","createSelectElements","on","scrollIntoView","scrollCursorIntoView","initialKeyMap","loadEditor","handleRequestForContentHeight","scrollHeight","getElementsByClassName","streamContextItem","uuid","isMetadataUpdate","getDoc","setValue","clearHistory","spellcheck","onReceivedNote"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"main.js","mappings":"AAAAA,WAAWC,QAAU,gCAErBC,SAASC,iBAAiB,oBAAoB,WAC5C,MAAMC,EAAiBJ,WAAWK,SAASC,QAAO,SAAUC,EAAKC,GAM/D,OALID,EAAIC,EAAEC,MACRF,EAAIC,EAAEC,MAAMC,KAAKF,GAEjBD,EAAIC,EAAEC,MAAQ,CAACD,GAEVD,CACT,GAAG,CAAC,GAEEI,EAAwBX,WAAWK,SAASC,QAAO,SAAUC,EAAKC,GAEtE,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,IACFA,GAAc,EACdH,EAAOkF,SAASE,gBAGlBpF,EAAOuB,UAAU,aAAc3B,EAAYY,QAAQ6E,YAEvD,CA5DIC,CAAejF,EAAI,GAsPzB","sources":["webpack://@standardnotes/classic-code-editor/./src/main.js"],"sourcesContent":["CodeMirror.modeURL = \"dist/codemirror/mode/%N/%N.js\";\n\ndocument.addEventListener('DOMContentLoaded', function () {\n const modeByModeMode = CodeMirror.modeInfo.reduce(function (acc, m) {\n if (acc[m.mode]) {\n acc[m.mode].push(m)\n } else {\n acc[m.mode] = [m]\n }\n return acc\n }, {})\n\n const modeModeAndMimeByName = CodeMirror.modeInfo.reduce(function (acc, m) {\n acc[m.name] = { mode: m.mode, mime: m.mime }\n return acc\n }, {})\n\n const modes = Object.keys(modeModeAndMimeByName)\n\n let componentRelay\n let workingNote, clientData\n let lastValue, lastUUID\n let editor, select\n let ignoreTextChange = false\n let initialLoad = true\n\n function loadComponentRelay() {\n componentRelay = new ComponentRelay({\n targetWindow: window,\n onReady: () => {\n const platform = componentRelay.platform\n if (platform) {\n document.body.classList.add(platform)\n }\n loadEditor()\n },\n handleRequestForContentHeight: () => {\n const baseHeight = 50\n const scrollHeight = document.getElementsByClassName('CodeMirror-code')[0]?.scrollHeight\n return baseHeight + scrollHeight\n },\n })\n\n componentRelay.streamContextItem((note) => {\n onReceivedNote(note)\n })\n }\n\n function saveNote() {\n if (workingNote) {\n // Be sure to capture this object as a variable, as this.note may be reassigned in `streamContextItem`, so by the time\n // you modify it in the presave block, it may not be the same object anymore, so the presave values will not be applied to\n // the right object, and it will save incorrectly.\n let note = workingNote\n\n componentRelay.saveItemWithPresave(note, () => {\n lastValue = editor.getValue()\n note.content.text = lastValue\n note.clientData = clientData\n\n note.content.preview_plain = null\n note.content.preview_html = null\n })\n }\n }\n\n function onReceivedNote(note) {\n if (note.uuid !== lastUUID) {\n // Note changed, reset last values\n lastValue = null\n initialLoad = true\n lastUUID = note.uuid\n }\n\n workingNote = note\n // Only update UI on non-metadata updates.\n if (note.isMetadataUpdate) {\n return\n }\n\n clientData = note.clientData\n let mode = clientData.mode\n\n if (!mode) {\n // Assign editor's default mode from component settings\n mode = componentRelay.getComponentDataValueForKey('language') ?? 'JavaScript'\n }\n\n changeMode(mode)\n\n if (editor) {\n if (note.content.text !== lastValue) {\n ignoreTextChange = true\n editor.getDoc().setValue(workingNote.content.text)\n ignoreTextChange = false\n }\n\n if (initialLoad) {\n initialLoad = false\n editor.getDoc().clearHistory()\n }\n\n editor.setOption('spellcheck', workingNote.content.spellcheck)\n }\n }\n\n function loadEditor() {\n // Handler for the save command that is mapped to the :w (write) Vim key binding.\n CodeMirror.commands.save = function () {\n saveNote()\n }\n editor = CodeMirror.fromTextArea(document.getElementById('code'), {\n extraKeys: {\n 'Alt-F': 'findPersistent',\n },\n lineNumbers: true,\n styleSelectedText: true,\n lineWrapping: true,\n inputStyle: getInputStyleForEnvironment(),\n })\n editor.setSize('100%', '100%')\n\n createSelectElements()\n\n editor.on('change', function () {\n if (ignoreTextChange) {\n return\n }\n saveNote()\n })\n\n /**\n * Scrolls the cursor into view, so the soft keyboard on mobile devices\n * doesn't overlap the cursor. A short delay is added to prevent scrolling\n * before the keyboard is shown.\n */\n const scrollCursorIntoView = (editor) => {\n setTimeout(() => editor.scrollIntoView(), 200)\n }\n\n editor.on('cursorActivity', function (editor) {\n if (componentRelay.environment !== 'mobile') {\n return\n }\n scrollCursorIntoView(editor)\n })\n\n const initialKeyMap = componentRelay.getComponentDataValueForKey('keyMap') ?? 'default'\n window.setKeyMap(initialKeyMap)\n }\n\n function createSelectElements() {\n select = document.getElementById('language-select')\n for (let index = 0; index < modes.length; index++) {\n const option = document.createElement('option')\n option.value = index\n option.innerHTML = modes[index]\n select.appendChild(option)\n }\n }\n\n // Editor Modes\n window.setKeyMap = function (keymap) {\n editor.setOption('keyMap', keymap)\n updateVimStatus(keymap)\n }\n\n function onLanguageSelect() {\n const language = modes[select.selectedIndex]\n changeMode(language)\n saveNote()\n }\n\n document.getElementById('language-select').addEventListener('change', onLanguageSelect)\n\n function setDefaultLanguage() {\n const language = modes[select.selectedIndex]\n\n // assign default language for this editor when entering notes\n componentRelay.setComponentDataValueForKey('language', language)\n\n // show a confirmation message\n const message = document.getElementById('default-label')\n const original = message.innerHTML\n message.innerHTML = 'Success'\n message.classList.add('success')\n\n setTimeout(function () {\n message.classList.remove('success')\n message.innerHTML = original\n }, 750)\n }\n\n document.getElementById('default-label').addEventListener('click', setDefaultLanguage)\n\n function inputModeToMode(inputMode) {\n const convertCodeMirrorMode = function (codeMirrorMode) {\n if (codeMirrorMode) {\n return {\n name: codeMirrorMode.name,\n mode: codeMirrorMode.mode,\n mime: codeMirrorMode.mime,\n }\n } else {\n return null\n }\n }\n\n const extension = /.+\\.([^.]+)$/.exec(inputMode)\n const mime = /\\//.test(inputMode)\n\n if (extension) {\n return convertCodeMirrorMode(CodeMirror.findModeByExtension(extension[1]))\n } else if (mime) {\n return convertCodeMirrorMode(CodeMirror.findModeByMIME(mime[1]))\n } else if (modeModeAndMimeByName[inputMode]) {\n return {\n name: inputMode,\n mode: modeModeAndMimeByName[inputMode].mode,\n mime: modeModeAndMimeByName[inputMode].mime,\n }\n } else if (modeByModeMode[inputMode]) {\n const firstMode = modeByModeMode[inputMode][0]\n return {\n name: firstMode.name,\n mode: firstMode.mode,\n mime: firstMode.mime,\n }\n } else {\n return {\n name: inputMode,\n mode: inputMode,\n mime: inputMode,\n }\n }\n }\n\n function changeMode(inputMode) {\n if (!inputMode) {\n return\n }\n\n const mode = inputModeToMode(inputMode)\n\n if (mode) {\n editor.setOption('mode', mode.mime)\n CodeMirror.autoLoadMode(editor, mode.mode)\n if (clientData) {\n clientData.mode = mode.name\n }\n document.getElementById('language-select').selectedIndex = modes.indexOf(mode.name)\n } else {\n console.error('Could not find a mode corresponding to ' + inputMode)\n }\n }\n\n function updateVimStatus(keyMap) {\n const toggleButton = document.getElementById('toggle-vim-mode-button')\n\n const newAction = keyMap === 'vim' ? 'Disable' : 'Enable'\n const buttonClass = keyMap === 'vim' ? 'danger' : 'success'\n\n toggleButton.innerHTML = `${newAction} Vim mode`\n toggleButton.classList.remove('danger')\n toggleButton.classList.remove('success')\n toggleButton.classList.add(buttonClass)\n }\n\n function toggleVimMode() {\n let newKeyMap\n\n const currentKeyMap = componentRelay.getComponentDataValueForKey('keyMap') ?? 'default'\n if (currentKeyMap === 'default') {\n newKeyMap = 'vim'\n } else {\n newKeyMap = 'default'\n }\n\n window.setKeyMap(newKeyMap)\n componentRelay.setComponentDataValueForKey('keyMap', newKeyMap)\n }\n\n document.getElementById('toggle-vim-mode-button').addEventListener('click', toggleVimMode)\n\n function getInputStyleForEnvironment() {\n const environment = componentRelay.environment ?? 'web'\n return environment === 'mobile' ? 'textarea' : 'contenteditable'\n }\n\n loadComponentRelay()\n})\n"],"names":["CodeMirror","modeURL","document","addEventListener","modeByModeMode","modeInfo","reduce","acc","m","mode","push","modeModeAndMimeByName","name","mime","modes","Object","keys","componentRelay","workingNote","clientData","lastValue","lastUUID","editor","select","ignoreTextChange","initialLoad","saveNote","note","saveItemWithPresave","getValue","content","text","preview_plain","preview_html","changeMode","inputMode","convertCodeMirrorMode","codeMirrorMode","extension","exec","test","findModeByExtension","findModeByMIME","firstMode","inputModeToMode","setOption","autoLoadMode","getElementById","selectedIndex","indexOf","console","error","window","setKeyMap","keymap","keyMap","toggleButton","newAction","buttonClass","innerHTML","classList","remove","add","updateVimStatus","language","setComponentDataValueForKey","message","original","setTimeout","newKeyMap","getComponentDataValueForKey","ComponentRelay","targetWindow","onReady","platform","body","commands","save","fromTextArea","extraKeys","lineNumbers","styleSelectedText","lineWrapping","inputStyle","environment","setSize","index","length","option","createElement","value","appendChild","createSelectElements","on","scrollIntoView","scrollCursorIntoView","initialKeyMap","loadEditor","handleRequestForContentHeight","scrollHeight","getElementsByClassName","streamContextItem","uuid","isMetadataUpdate","getDoc","setValue","clearHistory","spellcheck","onReceivedNote"],"sourceRoot":""}
|
|
@@ -28,32 +28,29 @@
|
|
|
28
28
|
<script src="dist/lib/component-relay.js"></script>
|
|
29
29
|
<!-- Required for styling selected text -->
|
|
30
30
|
<script src="dist/codemirror/addon/selection/mark-selection.js"></script>
|
|
31
|
-
<script>
|
|
32
|
-
CodeMirror.modeURL = "dist/codemirror/mode/%N/%N.js";
|
|
33
|
-
</script>
|
|
34
31
|
</head>
|
|
35
32
|
|
|
36
33
|
<body class="sn-component">
|
|
37
34
|
<div class="wrapper">
|
|
38
35
|
<textarea id="code" name="code"></textarea>
|
|
39
36
|
<div>
|
|
40
|
-
<div class="sk-app-bar no-edges no-bottom-edge"
|
|
37
|
+
<div id="bar" class="sk-app-bar no-edges no-bottom-edge">
|
|
41
38
|
<div class="left">
|
|
42
39
|
<div class="sk-app-bar-item no-pointer">
|
|
43
40
|
<span class="sk-p">Language:</span>
|
|
44
41
|
</div>
|
|
45
42
|
<div class="sk-app-bar-item no-pointer">
|
|
46
|
-
<select id="language-select"
|
|
43
|
+
<select id="language-select"></select>
|
|
47
44
|
</div>
|
|
48
45
|
<div class="sk-app-bar-item">
|
|
49
|
-
<span id="default-label" class="sk-label"
|
|
46
|
+
<span id="default-label" class="sk-label">Set as Default</span>
|
|
50
47
|
</div>
|
|
51
48
|
</div>
|
|
52
49
|
<div class="center"></div>
|
|
53
50
|
<div class="right">
|
|
54
51
|
<div class="sk-app-bar-item no-pointer border"></div>
|
|
55
52
|
<div class="sk-app-bar-item">
|
|
56
|
-
<span id="toggle-vim-mode-button" class="sk-label"
|
|
53
|
+
<span id="toggle-vim-mode-button" class="sk-label">Enable Vim mode</span>
|
|
57
54
|
</div>
|
|
58
55
|
</div>
|
|
59
56
|
</div>
|