Updated code system to dynamically set php codemirror mode

- Codemirror mode mapping value can now be a function to dynamically set
mode depending on actual code content.
- Used above system to set php mode type, depending on if '<?php' tags
exist in content.

Closes #1557
This commit is contained in:
Dan Brown
2019-12-07 16:23:44 +00:00
parent 7af6fe4917
commit a6bbe46987
3 changed files with 40 additions and 24 deletions

View File

@ -160,7 +160,7 @@ function codePlugin() {
let cmInstance = editorElem.CodeMirror;
if (cmInstance) {
Code.setContent(cmInstance, code);
Code.setMode(cmInstance, lang);
Code.setMode(cmInstance, lang, code);
}
let textArea = selectedNode.querySelector('textarea');
if (textArea) textArea.textContent = code;