From: Dan Brown Date: Thu, 17 Oct 2019 20:09:05 +0000 (+0100) Subject: Merge branch 'master' of git://github.com/c0shea/BookStack into c0shea-master X-Git-Tag: v0.28.0~1^2~66 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/8b4bfa4d780a3d586d0ad3dc64ff11822a0c3fbf?ds=inline;hp=-c Merge branch 'master' of git://github.com/c0shea/BookStack into c0shea-master --- 8b4bfa4d780a3d586d0ad3dc64ff11822a0c3fbf diff --combined resources/js/services/code.js index eedbda4bb,f92752109..70355643d --- a/resources/js/services/code.js +++ b/resources/js/services/code.js @@@ -16,6 -16,7 +16,7 @@@ import 'codemirror/mode/mllike/mllike' import 'codemirror/mode/nginx/nginx'; import 'codemirror/mode/php/php'; import 'codemirror/mode/powershell/powershell'; + import 'codemirror/mode/properties/properties'; import 'codemirror/mode/python/python'; import 'codemirror/mode/ruby/ruby'; import 'codemirror/mode/rust/rust'; @@@ -42,6 -43,7 +43,7 @@@ const modeMap = haskell: 'haskell', hs: 'haskell', html: 'htmlmixed', + ini: 'ini', javascript: 'javascript', json: {name: 'javascript', json: true}, js: 'javascript', @@@ -54,6 -56,7 +56,7 @@@ ml: 'mllike', nginx: 'nginx', powershell: 'powershell', + properties: 'properties', ocaml: 'mllike', php: 'php', py: 'python', @@@ -102,7 -105,6 +105,7 @@@ function highlightElem(elem) value: content, mode: mode, lineNumbers: true, + lineWrapping: false, theme: getTheme(), readOnly: true }); @@@ -189,7 -191,6 +192,7 @@@ function wysiwygView(elem) value: content, mode: getMode(lang), lineNumbers: true, + lineWrapping: false, theme: getTheme(), readOnly: true }); @@@ -215,8 -216,8 +218,8 @@@ function popupEditor(elem, modeSuggesti value: content, mode: getMode(modeSuggestion), lineNumbers: true, - theme: getTheme(), - lineWrapping: true + lineWrapping: false, + theme: getTheme() }); } @@@ -242,27 -243,24 +245,27 @@@ function setContent(cmInstance, codeCon } /** - * Get a CodeMirror instace to use for the markdown editor. + * Get a CodeMirror instance to use for the markdown editor. * @param {HTMLElement} elem * @returns {*} */ function markdownEditor(elem) { - let content = elem.textContent; - - return CodeMirror(function (elt) { - elem.parentNode.insertBefore(elt, elem); - elem.style.display = 'none'; - }, { + const content = elem.textContent; + const config = { value: content, mode: "markdown", lineNumbers: true, - theme: getTheme(), lineWrapping: true, + theme: getTheme(), scrollPastEnd: true, - }); + }; + + window.$events.emitPublic(elem, 'editor-markdown-cm::pre-init', {config}); + + return CodeMirror(function (elt) { + elem.parentNode.insertBefore(elt, elem); + elem.style.display = 'none'; + }, config); } /**