本文整理汇总了TypeScript中tinymce/core/api/Editor.getParam函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getParam函数的具体用法?TypeScript getParam怎么用?TypeScript getParam使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getParam函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const getTextComponents = (): SimpleSpec[] => {
const components: SimpleSpec[] = [];
if (editor.getParam('elementpath', true, 'boolean')) {
components.push(ElementPath.renderElementPath(editor, { }));
}
if (Strings.contains(editor.settings.plugins, 'wordcount')) {
components.push(renderWordCount(editor, providersBackstage));
}
if (editor.getParam('branding', true, 'boolean')) {
components.push(renderBranding());
}
if (components.length > 0) {
return [{
dom: {
tag: 'div',
classes: [ 'tox-statusbar__text-container']
},
components,
}];
}
return [];
};
示例2:
const isToolbarEnabled = (editor: Editor) => {
const toolbarConfig = editor.getParam('toolbar');
if (Type.isArray(toolbarConfig)) {
return toolbarConfig.length > 0;
} else {
return editor.getParam('toolbar', true, 'boolean') !== false;
}
};
示例3: function
const getPreviewHtml = function (editor: Editor) {
let headHtml = '';
const encode = editor.dom.encode;
const contentStyle = Settings.getContentStyle(editor);
headHtml += '<base href="' + encode(editor.documentBaseURI.getURI()) + '">';
if (contentStyle) {
headHtml += '<style type="text/css">' + contentStyle + '</style>';
}
Tools.each(editor.contentCSS, function (url) {
headHtml += '<link type="text/css" rel="stylesheet" href="' + encode(editor.documentBaseURI.toAbsolute(url)) + '">';
});
let bodyId = editor.settings.body_id || 'tinymce';
if (bodyId.indexOf('=') !== -1) {
bodyId = editor.getParam('body_id', '', 'hash');
bodyId = bodyId[editor.id] || bodyId;
}
let bodyClass = editor.settings.body_class || '';
if (bodyClass.indexOf('=') !== -1) {
bodyClass = editor.getParam('body_class', '', 'hash');
bodyClass = bodyClass[editor.id] || '';
}
const preventClicksOnLinksScript = (
'<script>' +
'document.addEventListener && document.addEventListener("click", function(e) {' +
'for (var elm = e.target; elm; elm = elm.parentNode) {' +
'if (elm.nodeName === "A") {' +
'e.preventDefault();' +
'}' +
'}' +
'}, false);' +
'</script> '
);
const directionality = editor.getBody().dir;
const dirAttr = directionality ? ' dir="' + encode(directionality) + '"' : '';
const previewHtml = (
'<!DOCTYPE html>' +
'<html>' +
'<head>' +
headHtml +
'</head>' +
'<body id="' + encode(bodyId) + '" class="mce-content-body ' + encode(bodyClass) + '"' + dirAttr + '>' +
editor.getContent() +
preventClicksOnLinksScript +
'</body>' +
'</html>'
);
return previewHtml;
};
示例4: function
const renderUI = function (): ModeRenderInfo {
SilverContextMenu.setup(editor, lazySink, backstage);
Sidebar.setup(editor);
Throbber.setup(editor, lazyThrobber, backstage.shared);
// Apply Bridge types
const { buttons, menuItems, contextToolbars, sidebars } = editor.ui.registry.getAll();
const rawUiConfig: RenderUiConfig = {
menuItems,
buttons,
// Apollo, not implemented yet, just patched to work
menus: !editor.settings.menu ? {} : Obj.map(editor.settings.menu, (menu) => Merger.merge(menu, { items: menu.items })),
menubar: editor.settings.menubar,
toolbar: getMultipleToolbarsSetting(editor).getOr(editor.getParam('toolbar', true)),
// Apollo, not implemented yet
sidebar: sidebars
};
ContextToolbar.register(editor, contextToolbars, sink, { backstage });
const elm = editor.getElement();
const height = setEditorSize(elm);
const uiComponents: RenderUiComponents = { mothership, uiMothership, outerContainer };
const args: RenderArgs = { targetNode: elm, height };
return mode.render(editor, uiComponents, rawUiConfig, backstage, args);
};
示例5: getHeightSetting
const setEditorSize = (elm) => {
// Set height and width if they were given, though height only applies to iframe mode
const DOM = DOMUtils.DOM;
const baseWidth = editor.getParam('width', DOM.getStyle(elm, 'width'));
const baseHeight = getHeightSetting(editor);
const minWidth = getMinWidthSetting(editor);
const minHeight = getMinHeightSetting(editor);
const parsedWidth = Utils.parseToInt(baseWidth).bind((w) => {
return Utils.numToPx(minWidth.map((mw) => Math.max(w, mw)));
}).getOr(Utils.numToPx(baseWidth));
const parsedHeight = Utils.parseToInt(baseHeight).bind((h) => {
return minHeight.map((mh) => Math.max(h, mh));
}).getOr(baseHeight);
const stringWidth = Utils.numToPx(parsedWidth);
if (Css.isValidValue('div', 'width', stringWidth)) {
Css.set(outerContainer.element(), 'width', stringWidth);
}
if (!editor.inline) {
const stringHeight = Utils.numToPx(parsedHeight);
if (Css.isValidValue('div', 'height', stringHeight)) {
Css.set(outerContainer.element(), 'height', stringHeight);
} else {
Css.set(outerContainer.element(), 'height', '200px');
}
}
return parsedHeight;
};
示例6: function
const getSpellcheckerWordcharPattern = function (editor: Editor) {
const defaultPattern = new RegExp('[^' +
'\\s!"#$%&()*+,-./:;<=>?@[\\]^_{|}`' +
'\u00a7\u00a9\u00ab\u00ae\u00b1\u00b6\u00b7\u00b8\u00bb' +
'\u00bc\u00bd\u00be\u00bf\u00d7\u00f7\u00a4\u201d\u201c\u201e\u00a0\u2002\u2003\u2009' +
']+', 'g');
return editor.getParam('spellchecker_wordchar_pattern', defaultPattern);
};
示例7:
const getWordValidElements = (editor: Editor): string => {
const defaultValidElements = (
'-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' +
'-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' +
'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody'
);
return editor.getParam('paste_word_valid_elements', defaultValidElements);
};
示例8: if
const getCloneElements = (editor: Editor): Option<string[]> => {
const cloneElements = editor.getParam('table_clone_elements');
if (Type.isString(cloneElements)) {
return Option.some(cloneElements.split(/[ ,]/));
} else if (Array.isArray(cloneElements)) {
return Option.some(cloneElements);
} else {
return Option.none();
}
};
示例9: encode
const getPreviewContent = (editor: Editor, html: string) => {
if (html.indexOf('<html>') === -1) {
let contentCssLinks = '';
Tools.each(editor.contentCSS, (url) => {
contentCssLinks += '<link type="text/css" rel="stylesheet" href="' +
editor.documentBaseURI.toAbsolute(url) +
'">';
});
let bodyClass = editor.settings.body_class || '';
if (bodyClass.indexOf('=') !== -1) {
bodyClass = editor.getParam('body_class', '', 'hash');
bodyClass = bodyClass[editor.id] || '';
}
const encode = editor.dom.encode;
const directionality = editor.getBody().dir;
const dirAttr = directionality ? ' dir="' + encode(directionality) + '"' : '';
html = (
'<!DOCTYPE html>' +
'<html>' +
'<head>' +
contentCssLinks +
'</head>' +
'<body class="' + encode(bodyClass) + '"' + dirAttr + '>' +
html +
'</body>' +
'</html>'
);
}
return Templates.replaceTemplateValues(html, Settings.getPreviewReplaceValues(editor));
};
示例10:
const getEmoticonDatabaseUrl = (editor: Editor, pluginUrl: string): string => {
return editor.getParam('emoticons_database_url', `${pluginUrl}/js/emojis${editor.suffix}.js`);
};