|
@@ -214,16 +214,54 @@ class PlaceholderContentWidget {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function do_monaco_init(monaco_thema) {
|
|
|
|
|
- require.config({ paths: { 'vs': 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.40.0/min/vs' }});
|
|
|
|
|
- require.config({ 'vs/nls': { availableLanguages: { '*': 'ko' } }});
|
|
|
|
|
|
|
+function do_monaco_init(monaco_thema, markup = "") {
|
|
|
|
|
+ require.config({ paths: { 'vs' : 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.40.0/min/vs' }});
|
|
|
|
|
+ require.config({ 'vs/nls' : { availableLanguages: { '*' : 'ko' } }});
|
|
|
require(["vs/editor/editor.main"], function () {
|
|
require(["vs/editor/editor.main"], function () {
|
|
|
|
|
+ monaco.languages.register({ id : "namumark" });
|
|
|
|
|
+ monaco.languages.setMonarchTokensProvider("namumark", {
|
|
|
|
|
+ tokenizer : {
|
|
|
|
|
+ root : [
|
|
|
|
|
+ [/\[/, "namumark-color"],
|
|
|
|
|
+ [/\]/, "namumark-color"],
|
|
|
|
|
+
|
|
|
|
|
+ [/\{/, "namumark-color"],
|
|
|
|
|
+ [/\}/, "namumark-color"],
|
|
|
|
|
+
|
|
|
|
|
+ [/'/, "namumark-color"],
|
|
|
|
|
+ [/-/, "namumark-color"],
|
|
|
|
|
+ [/~/, "namumark-color"],
|
|
|
|
|
+ [/=/, "namumark-color"],
|
|
|
|
|
+ [/_/, "namumark-color"],
|
|
|
|
|
+ [/\^/, "namumark-color"],
|
|
|
|
|
+ [/,/, "namumark-color"],
|
|
|
|
|
+
|
|
|
|
|
+ [/\\/, "namumark-color"],
|
|
|
|
|
+ [/\*/, "namumark-color"],
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ let thema_set = [["namumark", "vs"], ["namumark-vs-dark", "vs-dark"]]
|
|
|
|
|
+ for(let for_a = 0; for_a < thema_set.length; for_a++) {
|
|
|
|
|
+ monaco.editor.defineTheme(thema_set[for_a][0], {
|
|
|
|
|
+ base : thema_set[for_a][1],
|
|
|
|
|
+ inherit : true,
|
|
|
|
|
+ rules : [
|
|
|
|
|
+ { token : "namumark-color", foreground : "d94844" },
|
|
|
|
|
+ ],
|
|
|
|
|
+ colors : {
|
|
|
|
|
+ "editor.foreground" : "",
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
window.editor = monaco.editor.create(document.getElementById('opennamu_monaco_editor'), {
|
|
window.editor = monaco.editor.create(document.getElementById('opennamu_monaco_editor'), {
|
|
|
- value: document.getElementById('opennamu_edit_textarea').value,
|
|
|
|
|
- language: 'plaintext',
|
|
|
|
|
- automaticLayout: true,
|
|
|
|
|
- wordWrap: true,
|
|
|
|
|
- theme: monaco_thema
|
|
|
|
|
|
|
+ value : document.getElementById('opennamu_edit_textarea').value,
|
|
|
|
|
+ language : 'namumark',
|
|
|
|
|
+ automaticLayout : true,
|
|
|
|
|
+ wordWrap : true,
|
|
|
|
|
+ theme : "namumark" + (monaco_thema === "" ? "" : "-" + monaco_thema)
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
new PlaceholderContentWidget(document.getElementById('opennamu_edit_textarea').placeholder, window.editor);
|
|
new PlaceholderContentWidget(document.getElementById('opennamu_edit_textarea').placeholder, window.editor);
|