本文整理汇总了TypeScript中tinymce/core/api/EditorManager.init函数的典型用法代码示例。如果您正苦于以下问题:TypeScript init函数的具体用法?TypeScript init怎么用?TypeScript init使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了init函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
suite.asyncTest('Do not reload language pack if it was already loaded or registered manually.', function (_, done) {
const langCode = 'mce_lang';
const langUrl = 'http://example.com/language/' + langCode + '.js';
EditorManager.addI18n(langCode, {
from: 'to'
});
viewBlock.update('<textarea></textarea>');
EditorManager.init({
selector: 'textarea',
skin_url: '/project/js/tinymce/skins/lightgray',
language: langCode,
language_url: langUrl,
init_instance_callback (ed) {
const scripts = Tools.grep(document.getElementsByTagName('script'), function (script) {
return script.src === langUrl;
});
LegacyUnit.equal(scripts.length, 0);
teardown(done);
}
});
});
示例2: function
const setup = function (success, failure) {
const div = document.createElement('div');
div.innerHTML = (
'<div id="lists">' +
'<ul><li>before</li></ul>' +
'<ul id="inline"><li>x</li></ul>' +
'<ul><li>after</li></ul>' +
'</div>'
);
document.body.appendChild(div);
EditorManager.init({
selector: '#inline',
inline: true,
add_unload_trigger: false,
skin: false,
plugins: 'lists',
disable_nodechange: true,
init_instance_callback (editor) {
Pipeline.async({}, suite.toSteps(editor), function () {
teardown(editor, div);
success();
}, failure);
},
valid_styles: {
'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,' +
'margin,margin-top,margin-right,margin-bottom,margin-left,display,position,top,left,list-style-type'
}
});
};
示例3: function
suite.asyncTest('selector on non existing targets', function (_, done) {
EditorManager.init({
selector: '#non-existing-id',
skin_url: '/project/js/tinymce/skins/lightgray'
}).then(function (result) {
Assertions.assertEq('Should be an result that is zero length', 0, result.length);
teardown(done);
});
});
示例4:
const mCreateInlineModeMultipleInstances = Step.stateful(function (value, next, die) {
viewBlock.update('<div class="tinymce-editor"><p>a</p></div><div class="tinymce-editor"><p>b</p></div>');
EditorManager.init({
selector: '.tinymce-editor',
inline: true,
skin_url: '/project/js/tinymce/skins/lightgray'
}).then(next, die);
});
示例5:
const mCreateInlineModeMultipleInstances = Step.label('mCreateInlineModeMultipleInstances', Step.stateful(function (value, next, die) {
viewBlock.update('<div class="tinymce-editor"><p>a</p></div><div class="tinymce-editor"><p>b</p></div>');
EditorManager.init({
selector: '.tinymce-editor',
inline: true,
skin_url: '/project/tinymce/js/tinymce/skins/ui/oxide',
content_css: '/project/tinymce/js/tinymce/skins/content/default',
}).then(next, die);
}));
示例6: done
return Step.async(function (done) {
viewBlock.update(html);
EditorManager.init({
selector: '.tinymce',
inline: true,
skin_url: '/project/js/tinymce/skins/lightgray'
}).then(function () {
done();
});
});
示例7: function
suite.asyncTest('get', function (_, done) {
viewBlock.update('<textarea class="tinymce"></textarea>');
EditorManager.init({
selector: 'textarea.tinymce',
skin_url: '/project/tinymce/js/tinymce/skins/ui/oxide',
content_css: '/project/tinymce/js/tinymce/skins/content/default',
init_instance_callback (editor1) {
LegacyUnit.equal(EditorManager.get().length, 1);
LegacyUnit.equal(EditorManager.get(0) === EditorManager.activeEditor, true);
LegacyUnit.equal(EditorManager.get(1), null);
LegacyUnit.equal(EditorManager.get('noid'), null);
LegacyUnit.equal(EditorManager.get(undefined), null);
LegacyUnit.equal(EditorManager.get()[0] === EditorManager.activeEditor, true);
LegacyUnit.equal(EditorManager.get(EditorManager.activeEditor.id) === EditorManager.activeEditor, true);
LegacyUnit.equal(EditorManager.get() !== EditorManager.get(), true);
// Trigger save
let saveCount = 0;
editor1.on('SaveContent', function () {
saveCount++;
});
EditorManager.triggerSave();
LegacyUnit.equal(saveCount, 1);
// Re-init on same id
EditorManager.init({
selector: '#' + EditorManager.activeEditor.id,
skin_url: '/project/tinymce/js/tinymce/skins/ui/oxide',
content_css: '/project/tinymce/js/tinymce/skins/content/default',
});
LegacyUnit.equal(EditorManager.get().length, 1);
teardown(done);
}
});
});