diff --git a/js/2.0.0/buildForm.js b/js/2.0.0/buildForm.js index 799dae7..b590c21 100644 --- a/js/2.0.0/buildForm.js +++ b/js/2.0.0/buildForm.js @@ -408,6 +408,7 @@ function buildLongTextInput(source, textarea, label) { textarea.style.display = "none"; label.style.display = "none"; + let title = document.createElement("span"); title.innerText = label.innerText; @@ -427,10 +428,14 @@ function buildLongTextInput(source, textarea, label) { "olist" ], onChange: function (html) { + //correct lastElement + activeState.lastElement = textarea.id; textarea.value = html; }, }); + activeState.editor = editor; + let actionBar = editor.getElementsByClassName("pell-actionbar")[0]; let content = editor.getElementsByClassName("pell-content")[0]; @@ -438,6 +443,7 @@ function buildLongTextInput(source, textarea, label) { let newActionBarElements = []; for (let actionBarElement of actionBarElements ) { actionBarElement.classList.add("w3-right"); + actionBarElement.setAttribute("tabindex","-1"); newActionBarElements.push(actionBarElement); } //reverse actionbar back to org order diff --git a/js/2.0.0/evts.js b/js/2.0.0/evts.js index 2af8d24..34eb068 100644 --- a/js/2.0.0/evts.js +++ b/js/2.0.0/evts.js @@ -62,6 +62,14 @@ function insertTextBlocks(t) { element.value += insert; let tB = document.getElementById("navTb"); tB.className.replace(" w3-show", ""); + + if (element.parentElement != undefined) { + if (element.parentElement.getElementsByClassName("pell-content")[0] != undefined) { + activeState.editor.content.innerHTML = element.value; + element = element.parentElement.getElementsByClassName("pell-content")[0]; + } + } + element.focus(); } diff --git a/js/2.0.0/form.js b/js/2.0.0/form.js index 37d5901..d389085 100644 --- a/js/2.0.0/form.js +++ b/js/2.0.0/form.js @@ -283,6 +283,14 @@ function formEvts() { function focusOnField(id) { let targetElement = document.getElementById(id); + + //handle pell content focus + if (targetElement.parentElement != undefined) { + if (targetElement.parentElement.getElementsByClassName("pell-content")[0] != undefined) { + targetElement = targetElement.parentElement.getElementsByClassName("pell-content")[0]; + } + } + if (targetElement == null) return; document.activeElement.blur(); targetElement.focus(); diff --git a/js/2.0.0/init.js b/js/2.0.0/init.js index 148579d..89c23e5 100644 --- a/js/2.0.0/init.js +++ b/js/2.0.0/init.js @@ -46,7 +46,8 @@ window.activeState = { "markup", ], markups: ["title", "link", "italic", "green_highlighted", "highlighted"], - storage: [] + storage: [], + editor: null }; function init() {