本文整理汇总了TypeScript中tinymce/core/dom/DOMUtils.DOM.getParent方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.getParent方法的具体用法?TypeScript DOM.getParent怎么用?TypeScript DOM.getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tinymce/core/dom/DOMUtils.DOM
的用法示例。
在下文中一共展示了DOM.getParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const save = function (editor) {
let formObj;
formObj = DOMUtils.DOM.getParent(editor.id, 'form');
if (Settings.enableWhenDirty(editor) && !editor.isDirty()) {
return;
}
editor.save();
// Use callback instead
if (Settings.hasOnSaveCallback(editor)) {
editor.execCallback('save_onsavecallback', editor);
editor.nodeChanged();
return;
}
if (formObj) {
editor.setDirty(false);
if (!formObj.onsubmit || formObj.onsubmit()) {
if (typeof formObj.submit === 'function') {
formObj.submit();
} else {
displayErrorMessage(editor, 'Error: Form submit field collision.');
}
}
editor.nodeChanged();
} else {
displayErrorMessage(editor, 'Error: No form element found.');
}
};
示例2: function
return function (e) {
const buttonCtrl = this.parent();
let value;
const currentColor = TextColor.getCurrentColor(editor, buttonCtrl.settings.format);
const selectColor = function (value) {
buttonCtrl.hidePanel();
buttonCtrl.color(value);
editor.execCommand('mceApplyTextcolor', buttonCtrl.settings.format, value);
};
const resetColor = function () {
buttonCtrl.hidePanel();
buttonCtrl.resetColor();
editor.execCommand('mceRemoveTextcolor', buttonCtrl.settings.format);
};
if (DOMUtils.DOM.getParent(e.target, '.mce-custom-color-btn')) {
buttonCtrl.hidePanel();
const colorPickerCallback = Settings.getColorPickerCallback(editor);
colorPickerCallback.call(editor, function (value) {
const tableElm = buttonCtrl.panel.getEl().getElementsByTagName('table')[0];
let customColorCells, div, i;
customColorCells = Tools.map(tableElm.rows[tableElm.rows.length - 1].childNodes, function (elm) {
return elm.firstChild;
});
for (i = 0; i < customColorCells.length; i++) {
div = customColorCells[i];
if (!div.getAttribute('data-mce-color')) {
break;
}
}
// Shift colors to the right
// TODO: Might need to be the left on RTL
if (i === cols) {
for (i = 0; i < cols - 1; i++) {
setDivColor(customColorCells[i], customColorCells[i + 1].getAttribute('data-mce-color'));
}
}
setDivColor(div, value);
selectColor(value);
}, currentColor);
}
value = e.target.getAttribute('data-mce-color');
if (value) {
if (this.lastId) {
DOMUtils.DOM.get(this.lastId).setAttribute('aria-selected', false);
}
e.target.setAttribute('aria-selected', true);
this.lastId = e.target.id;
if (value === 'transparent') {
resetColor();
} else {
selectColor(value);
}
} else if (value !== null) {
buttonCtrl.hidePanel();
}
};