本文整理匯總了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();
}
};