本文整理汇总了TypeScript中tinymce/core/api/Editor.focus函数的典型用法代码示例。如果您正苦于以下问题:TypeScript focus函数的具体用法?TypeScript focus怎么用?TypeScript focus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了focus函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: parseInt
editor.undoManager.transact(() => {
if (!tableElm) {
const cols = parseInt(data.cols, 10) || 1;
const rows = parseInt(data.rows, 10) || 1;
// Cases 1 & 3 - inserting a table
tableElm = InsertTable.insert(editor, cols, rows);
}
applyDataToElement(editor, tableElm, data);
// Toggle caption on/off
captionElm = dom.select('caption', tableElm)[0];
if (captionElm && !data.caption) {
dom.remove(captionElm);
}
if (!captionElm && data.caption) {
captionElm = dom.create('caption');
captionElm.innerHTML = !Env.ie ? '<br data-mce-bogus="1"/>' : '\u00a0';
tableElm.insertBefore(captionElm, tableElm.firstChild);
}
if (data.align === '') {
Styles.unApplyAlign(editor, tableElm);
} else {
Styles.applyAlign(editor, tableElm, data.align);
}
editor.focus();
editor.addVisual();
});
示例2: execute
execute(table, targets).each((rng) => {
resizeChange(editor, beforeSize, table);
editor.selection.setRng(rng);
editor.focus();
cellSelection.clear(table);
Util.removeDataStyle(table);
});
示例3: switchRowType
editor.undoManager.transact(() => {
Tools.each(rows, (rowElm) => {
// Switch row type
if (data.type !== rowElm.parentNode.nodeName.toLowerCase()) {
switchRowType(editor.dom, rowElm, data.type);
}
const modifiers = createModifier(dom, rowElm);
modifiers.setAttrib('scope', data.scope);
modifiers.setAttrib('class', data.class);
modifiers.setStyle('height', Util.addSizeSuffix(data.height));
if (hasAdvancedRowTab(editor)) {
updateAdvancedProps(modifiers, data);
}
if (data.align !== oldData.align) {
Styles.unApplyAlign(editor, rowElm);
Styles.applyAlign(editor, rowElm, data.align);
}
});
editor.focus();
});
示例4: onAction
setup: (editor: Editor) => {
editor.ui.registry.addButton('annotate-alpha', {
text: 'Annotate',
onAction() {
const comment = prompt('Comment with?');
editor.annotator.annotate('alpha', {
comment
});
editor.focus();
},
onSetup (btnApi) {
editor.annotator.annotationChanged('alpha', (state, name, obj) => {
btnApi.setDisabled(state);
});
return () => {};
}
});
editor.on('init', () => {
editor.annotator.register('alpha', {
persistent: true,
decorate: (uid, data) => {
return {
attributes: {
'data-mce-comment': data.comment ? data.comment : '',
'data-mce-author': data.author ? data.author : 'anonymous'
}
};
}
});
});
},
示例5: restoreDraft
const restoreLastDraft = (editor: Editor) => {
editor.undoManager.transact(() => {
restoreDraft(editor);
removeDraft(editor);
});
editor.focus();
};
示例6: function
const togglePlainTextPaste = function (editor: Editor, clipboard: Clipboard) {
if (clipboard.pasteFormat.get() === 'text') {
clipboard.pasteFormat.set('html');
Events.firePastePlainTextToggle(editor, false);
} else {
clipboard.pasteFormat.set('text');
Events.firePastePlainTextToggle(editor, true);
}
editor.focus();
};
示例7: unlinkImageFigure
editor.undoManager.transact(() => {
const node = editor.selection.getNode();
if (isImageFigure(node)) {
unlinkImageFigure(editor, node);
} else {
const anchorElm = editor.dom.getParent(node, 'a[href]', editor.getBody());
if (anchorElm) {
editor.dom.remove(anchorElm, true);
}
}
editor.focus();
});
示例8:
const deleteImage = (editor: Editor, image: HTMLElement) => {
if (image) {
const elm = editor.dom.is(image.parentNode, 'figure.image') ? image.parentNode : image;
editor.dom.remove(elm);
editor.focus();
editor.nodeChanged();
if (editor.dom.isEmpty(editor.getBody())) {
editor.setContent('');
editor.selection.setCursorLocation();
}
}
};
示例9: function
const insert = function (editor: Editor, id: string) {
const selectedNode = editor.selection.getNode();
const isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
if (isAnchor) {
selectedNode.removeAttribute('name');
selectedNode.id = id;
editor.undoManager.add();
} else {
editor.focus();
editor.selection.collapse(true);
editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', {
id
}));
}
};
示例10: create
const insertImageAtCaret = (editor: Editor, data: ImageData) => {
const elm = create((css) => normalizeCss(editor, css), data);
editor.dom.setAttrib(elm, 'data-mce-id', '__mcenew');
editor.focus();
editor.selection.setContent(elm.outerHTML);
const insertedElm = editor.dom.select('*[data-mce-id="__mcenew"]')[0];
editor.dom.setAttrib(insertedElm, 'data-mce-id', null);
if (isFigure(insertedElm)) {
const figure = splitTextBlock(editor, insertedElm);
editor.selection.select(figure);
} else {
editor.selection.select(insertedElm);
}
};