Overview
| Comment: | [fx] button: node examination update |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | fx |
| Files: | files | file ages | folders |
| SHA3-256: |
f16babf55de3e4715c948bf2f806429b |
| User & Date: | olr on 2020-04-08 20:12:40 |
| Other Links: | manifest | tags |
Context
|
2020-04-09
| ||
| 07:04 | [fx] find the first editable node for context menu and shortcuts too check-in: 9bc8d9a943 user: olr tags: trunk, fx | |
|
2020-04-08
| ||
| 20:12 | [fx] button: node examination update check-in: f16babf55d user: olr tags: trunk, fx | |
| 13:50 | [fx] text area button: don’t show it for editable node that aren’t <p> or <div> check-in: dc0a47993e user: olr tags: trunk, fx | |
Changes
Modified gc_lang/fr/webext/content_scripts/menu.js from [1c8166f9c8] to [56c56fae1e].
| ︙ | ︙ | |||
34 35 36 37 38 39 40 |
if (oOptions.hasOwnProperty("ui_options")) {
this._bTextArea = oOptions.ui_options.textarea;
this._bEditableNode = oOptions.ui_options.editablenode;
}
}
examineNode (xNode) {
| | > > > > | > | | | | < | < | | | | > | | < > > > > > > | | < | > | | | > | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
if (oOptions.hasOwnProperty("ui_options")) {
this._bTextArea = oOptions.ui_options.textarea;
this._bEditableNode = oOptions.ui_options.editablenode;
}
}
examineNode (xNode) {
if (!xNode || !xNode instanceof HTMLElement) {
// not a node
this.reject();
return;
}
if (xNode === this.xTextNode) {
// same node -> possibly click for resizing -> move it
this.move();
return;
}
if ( ( (xNode.tagName == "TEXTAREA" && this._bTextArea && xNode.getAttribute("spellcheck") !== "false")
|| (xNode.tagName == "IFRAME" && this._bIframe) )
&& !(xNode.dataset.grammalecte_button && xNode.dataset.grammalecte_button == "false") ) {
// textarea or iframe
this.accept(xNode)
}
else if (xNode.isContentEditable && this._bEditableNode) {
// editable node
const findOriginEditableNode = function (xNode) {
return (!xNode.parentNode.isContentEditable) ? xNode : findOriginEditableNode(xNode.parentNode);
}
xNode = findOriginEditableNode(xNode);
if ((xNode.tagName == "P" || xNode.tagName == "DIV") && !(xNode.dataset.grammalecte_button && xNode.dataset.grammalecte_button == "false")) {
this.accept(xNode);
} else {
this.reject();
}
} else {
this.reject();
}
}
accept (xNode=null) {
if (xNode) {
this.xTextNode = xNode;
this.xButton.style.display = "none"; // we hide it before showing it again to relaunch the animation
this.move();
this.xButton.style.display = "block";
}
}
reject () {
this.xTextNode = null;
this.xButton.style.display = "none";
}
move () {
if (this.xTextNode) {
let oCoord = oGrammalecte.getElementCoord(this.xTextNode);
this.xButton.style.top = `${oCoord.bottom}px`;
|
| ︙ | ︙ |