Merge pull request #381 from Luis-Fernando-Molina/develop

Contribution: Bug Fixed:Not exiting edit mode when user types command
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-01-15 16:35:44 +01:00
commit 36d3812557
3 files changed
+12 -11

No files matched your search

@@ -2,7 +2,7 @@ function newSuperalgosDocsContextMenu() {
let thisObject = {
selectedParagraph: undefined,
getSelection: getSelection,
forceOutClick: forceOutClick,
removeContextMenuFromScreen: removeContextMenuFromScreen,
initialize: initialize,
finalize: finalize
}
@@ -53,7 +53,7 @@ function newSuperalgosDocsContextMenu() {
}
function editParagraph() {
forceOutClick()
removeContextMenuFromScreen()
showHTMLTextArea()
function showHTMLTextArea() {
@@ -107,7 +107,7 @@ function newSuperalgosDocsContextMenu() {
UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.appendChild(UI.projects.superalgos.spaces.docsSpace.textArea)
UI.projects.superalgos.spaces.docsSpace.textArea.style.display = 'block'
UI.projects.superalgos.spaces.docsSpace.textArea.focus()
forceOutClick()
removeContextMenuFromScreen()
UI.projects.superalgos.spaces.docsSpace.enterEditMode()
}
}
@@ -116,7 +116,7 @@ function newSuperalgosDocsContextMenu() {
if (selectedParagraphIndex === undefined) { return }
if (selectedParagraphIndex === 0) { return }
UI.projects.superalgos.spaces.docsSpace.documentPage.docsSchemaDocument.paragraphs.splice(selectedParagraphIndex, 1)
forceOutClick()
removeContextMenuFromScreen()
UI.projects.superalgos.spaces.docsSpace.documentPage.docsSchemaDocument.updated = true
UI.projects.superalgos.spaces.docsSpace.documentPage.render()
}
@@ -260,20 +260,20 @@ function newSuperalgosDocsContextMenu() {
}
UI.projects.superalgos.utilities.clipboard.copyTextToClipboard(clipboard)
forceOutClick()
removeContextMenuFromScreen()
}
function replaceStyle(docSchemaParagraph, style) {
if (docSchemaParagraph.style !== style) {
UI.projects.superalgos.spaces.docsSpace.documentPage.docsSchemaDocument.updated = true
docSchemaParagraph.style = style
forceOutClick()
removeContextMenuFromScreen()
UI.projects.superalgos.spaces.docsSpace.documentPage.render()
}
}
}
function forceOutClick() {
function removeContextMenuFromScreen() {
const outClick = document.getElementById('docs-space-div')
const menu = document.getElementById('menu')
menu.classList.remove('show')
@@ -1933,7 +1933,7 @@ function newSuperalgosDocsDocumentPage() {
outClick.addEventListener('click', () => {
if (EDITOR_ON_FOCUS !== true) {
UI.projects.superalgos.spaces.docsSpace.contextMenu.forceOutClick()
UI.projects.superalgos.spaces.docsSpace.contextMenu.removeContextMenuFromScreen()
}
})
}
@@ -1,9 +1,9 @@
function newSuperalgosDocsMainSearchPage() {
let thisObject = {
addSearchHeader: addSearchHeader,
addSearchHeader: addSearchHeader,
detectEnterOnSearchBox: detectEnterOnSearchBox,
setFocusOnSearchBox: setFocusOnSearchBox,
render: render,
render: render,
initialize: initialize,
finalize: finalize
}
@@ -51,8 +51,9 @@ function newSuperalgosDocsMainSearchPage() {
}
element.addEventListener("keyup", function (event) {
if (event.key === "Enter" || event.keyCode === 13) {
UI.projects.superalgos.spaces.docsSpace.exitEditMode()
UI.projects.superalgos.spaces.docsSpace.currentBookBeingRendered = undefined
UI.projects.superalgos.spaces.docsSpace.contextMenu.forceOutClick()
UI.projects.superalgos.spaces.docsSpace.contextMenu.removeContextMenuFromScreen()
UI.projects.superalgos.spaces.docsSpace.commandInterface.command = element.value.trim()
UI.projects.superalgos.spaces.docsSpace.commandInterface.detectCommands()
}