This commit is contained in:
Peter Savchenko 2016-04-27 20:47:02 +03:00
parent 7f6d3ceb71
commit f249570f54

View file

@ -268,10 +268,10 @@ cEditor.callback = {
if (cEditor.toolbar.opened && event.target == cEditor.nodes.redactor) { if (cEditor.toolbar.opened && event.target == cEditor.nodes.redactor) {
// event.preventDefault(); event.preventDefault();
cEditor.toolbar.toolClicked(event); cEditor.toolbar.toolClicked(event);
cEditor.toolbar.close(); // cEditor.toolbar.close();
}; };
@ -289,7 +289,7 @@ cEditor.callback = {
cEditor.content.workingNodeChanged(); cEditor.content.workingNodeChanged();
cEditor.toolbar.close(); // cEditor.toolbar.close();
cEditor.toolbar.move(); cEditor.toolbar.move();
}, },
@ -355,13 +355,26 @@ cEditor.content = {
focused; focused;
if (selection.anchorNode != null) { if (selection.anchorNode != null) {
focused = selection.anchorNode.tagName ? selection.anchorNode : selection.focusNode.parentElement;
if ( selection.anchorNode.nodeType == cEditor.core.nodeTypes.TAG ) {
focused = selection.anchorNode;
} else {
focused = selection.focusNode.parentElement;
}
} }
if ( !cEditor.parser.isFirstLevelBlock(focused) ) {
focused = focused.parentElement;
}
console.log('focused' , focused);
if (focused != cEditor.nodes.redactor){ if (focused != cEditor.nodes.redactor){
return focused; return focused;
} }
return null; return null;
}, },
@ -408,6 +421,9 @@ cEditor.content = {
* Set new node as current * Set new node as current
*/ */
cEditor.content.workingNodeChanged(nodeCreated); cEditor.content.workingNodeChanged(nodeCreated);
setTimeout(function() {
cEditor.content.currentNode.focus();
}, 100);
return; return;
} }
@ -433,6 +449,9 @@ cEditor.content = {
* Set new node as current * Set new node as current
*/ */
cEditor.content.workingNodeChanged(nodeCreated); cEditor.content.workingNodeChanged(nodeCreated);
setTimeout(function() {
cEditor.content.currentNode.focus();
}, 100);
} }