Populate EditorLink based on highlighted items

This commit is contained in:
Ian Gulliver
2019-07-11 04:40:43 +00:00
parent f7822b24b5
commit 7390acb978
3 changed files with 20 additions and 13 deletions

View File

@@ -84,21 +84,17 @@ class Editor extends List {
}
}
addLinkBefore() {
if (this.mayAdd(EditorLink)) {
EditorLink.addBefore(this.container_, this.getSelected());
}
}
addLinkAfter() {
if (this.mayAdd(EditorLink)) {
EditorLink.addAfter(this.container_, this.getSelected());
EditorLink.addAfter(this.container_, this.getSelected(),
this.queryEntries('.highlight', EditorNode));
}
}
addLinkBefore() {
if (this.mayAdd(EditorLink)) {
EditorLink.addBefore(this.container_, this.getSelected());
EditorLink.addBefore(this.container_, this.getSelected(),
this.queryEntries('.highlight', EditorNode));
}
}
@@ -179,8 +175,15 @@ class Editor extends List {
return;
case 'Escape':
for (let entry of this.queryEntries('.highlight')) {
entry.getElement().classList.toggle('highlight', false);
if (!this.container_.parentElement.xArchObj) {
for (let entry of this.queryEntries('.highlight')) {
entry.getElement().classList.toggle('highlight', false);
}
// TODO: rename this to data-arch-refresh, make value noop everywhere
this.container_.setAttribute('data-arch-value', '');
e.stopPropagation();
e.preventDefault();
return;
}
}