本文整理汇总了TypeScript中tinymce/core/api/util/Tools.extend函数的典型用法代码示例。如果您正苦于以下问题:TypeScript extend函数的具体用法?TypeScript extend怎么用?TypeScript extend使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了extend函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
const applyDataToElement = function (editor, tableElm, data) {
const dom = editor.dom;
const attrs: any = {};
let styles: any = {};
attrs.class = data.class;
styles.height = Util.addSizeSuffix(data.height);
if (dom.getAttrib(tableElm, 'width') && !shouldStyleWithCss(editor)) {
attrs.width = Util.removePxSuffix(data.width);
} else {
styles.width = Util.addSizeSuffix(data.width);
}
if (shouldStyleWithCss(editor)) {
styles['border-width'] = Util.addSizeSuffix(data.border);
styles['border-spacing'] = Util.addSizeSuffix(data.cellspacing);
Tools.extend(attrs, {
'data-mce-border-color': data.borderColor,
'data-mce-cell-padding': data.cellpadding,
'data-mce-border': data.border
});
} else {
Tools.extend(attrs, {
border: data.border,
cellpadding: data.cellpadding,
cellspacing: data.cellspacing
});
}
// TODO: this has to be reworked somehow, for example by introducing dedicated option, which
// will control whether child TD/THs should be processed or not
if (shouldStyleWithCss(editor)) {
if (tableElm.children) {
for (let i = 0; i < tableElm.children.length; i++) {
styleTDTH(dom, tableElm.children[i], {
'border-width': Util.addSizeSuffix(data.border),
'border-color': data.borderColor,
'padding': Util.addSizeSuffix(data.cellpadding)
});
}
}
}
if (data.style) {
// merge the styles from Advanced tab on top
Tools.extend(styles, dom.parseStyle(data.style));
} else {
// ... otherwise take styles from original elm and update them
styles = Tools.extend({}, dom.parseStyle(dom.getAttrib(tableElm, 'style')), styles);
}
attrs.style = dom.serializeStyle(styles);
dom.setAttribs(tableElm, attrs);
};
开发者ID:abstask,项目名称:tinymce,代码行数:57,代码来源:TableDialog.ts
示例2: function
const extractDataFromElement = function (editor: Editor, elm: HTMLElement) {
const dom = editor.dom;
const data: FormData = {
width: dom.getStyle(elm, 'width') || dom.getAttrib(elm, 'width'),
height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'),
scope: dom.getAttrib(elm, 'scope'),
class: dom.getAttrib(elm, 'class'),
type: elm.nodeName.toLowerCase(),
style: '',
align: '',
valign: ''
};
Tools.each('left center right'.split(' '), function (name: string) {
if (editor.formatter.matchNode(elm, 'align' + name)) {
data.align = name;
}
});
Tools.each('top middle bottom'.split(' '), function (name: string) {
if (editor.formatter.matchNode(elm, 'valign' + name)) {
data.valign = name;
}
});
if (hasAdvancedCellTab(editor)) {
Tools.extend(data, Helpers.extractAdvancedStyles(dom, elm));
}
return data;
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:31,代码来源:CellDialog.ts
示例3: FormItem
items.each(function (ctrl) {
let formItem;
const label = ctrl.settings.label;
if (label) {
formItem = new FormItem(Tools.extend({
items: {
type: 'label',
id: ctrl._id + '-l',
text: label,
flex: 0,
forId: ctrl._id,
disabled: ctrl.disabled()
}
}, self.settings.formItemDefaults));
formItem.type = 'formitem';
ctrl.aria('labelledby', ctrl._id + '-l');
if (typeof ctrl.settings.flex === 'undefined') {
ctrl.settings.flex = 1;
}
self.replace(ctrl, formItem);
formItem.add(ctrl);
}
});
开发者ID:danielpunkass,项目名称:tinymce,代码行数:27,代码来源:Form.ts
示例4: function
suite.test('Parse script elements', function () {
let counter, parser;
counter = createCounter(writer);
parser = SaxParser(counter, schema);
writer.reset();
parser.parse('text1<em><script>// <b>tag</b></s' + 'cript>text2</em>');
LegacyUnit.equal(writer.getContent(), 'text1<em><script>// <b>tag</b></s' + 'cript>text2</em>', 'Parse script element.');
LegacyUnit.deepEqual(counter.counts, { start: 2, end: 2, text: 3 }, 'Parse script element counts.');
counter = createCounter(writer);
parser = SaxParser(counter, schema);
writer.reset();
parser.parse('text1<em><script id="id">// <b>tag</b></s' + 'cript>text2</em>');
LegacyUnit.equal(
writer.getContent(),
'text1<em><script id="id">// <b>tag</b></s' + 'cript>text2</em>',
'Parse script element with attributes.'
);
LegacyUnit.deepEqual(counter.counts, { start: 2, end: 2, text: 3 }, 'Parse script element with attributes counts.');
counter = createCounter(writer);
parser = SaxParser(counter, schema);
writer.reset();
parser.parse('text1<em><script></s' + 'cript>text2</em>');
LegacyUnit.equal(writer.getContent(), 'text1<em><script></s' + 'cript>text2</em>', 'Parse empty script element.');
LegacyUnit.deepEqual(counter.counts, { text: 2, start: 2, end: 2 }, 'Parse empty script element counts.');
counter = createCounter(writer);
parser = SaxParser(Tools.extend({ validate: true }, counter), Schema({ invalid_elements: 'script' }));
writer.reset();
parser.parse('text1<em><s' + 'cript>text2</s' + 'cript>text3</em>');
LegacyUnit.equal(writer.getContent(), 'text1<em>text3</em>', 'Parse invalid script element.');
LegacyUnit.deepEqual(counter.counts, { text: 2, start: 1, end: 1 }, 'Parse invalid script element (count).');
});
开发者ID:abstask,项目名称:tinymce,代码行数:35,代码来源:SaxParserTest.ts
示例5: function
const extractDataFromElement = function (editor, elm) {
const dom = editor.dom;
const data: any = {
width: dom.getStyle(elm, 'width') || dom.getAttrib(elm, 'width'),
height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'),
scope: dom.getAttrib(elm, 'scope'),
class: dom.getAttrib(elm, 'class')
};
data.type = elm.nodeName.toLowerCase();
Tools.each('left center right'.split(' '), function (name) {
if (editor.formatter.matchNode(elm, 'align' + name)) {
data.align = name;
}
});
Tools.each('top middle bottom'.split(' '), function (name) {
if (editor.formatter.matchNode(elm, 'valign' + name)) {
data.valign = name;
}
});
if (editor.settings.table_cell_advtab !== false) {
Tools.extend(data, Helpers.extractAdvancedStyles(dom, elm));
}
return data;
};
开发者ID:,项目名称:,代码行数:29,代码来源:
示例6: function
const createPanel = function (settings) {
return Factory.create(Tools.extend({
type: 'panel',
layout: 'absolute',
width: 200,
height: 200
}, settings)).renderTo(viewBlock.get()).reflow();
};
开发者ID:abstask,项目名称:tinymce,代码行数:8,代码来源:AbsoluteLayoutTest.ts
示例7: function
const createPanel = function (settings) {
EventUtils.Event.clean(viewBlock.get());
viewBlock.update('');
return Factory.create(Tools.extend({
type: 'panel'
}, settings)).renderTo(viewBlock.get()).reflow();
};
开发者ID:abstask,项目名称:tinymce,代码行数:8,代码来源:PanelTest.ts
示例8: function
const createButton = function (settings) {
EventUtils.Event.clean(viewBlock.get());
viewBlock.update('');
return Factory.create(Tools.extend({
type: 'button'
}, settings)).renderTo(viewBlock.get());
};
开发者ID:abstask,项目名称:tinymce,代码行数:8,代码来源:ButtonTest.ts
示例9: getUrl
const matchPattern = (url: string): UrlPattern => {
const pattern = urlPatterns.filter((pattern) => pattern.regex.test(url));
if (pattern.length > 0) {
return Tools.extend({}, pattern[0], { url: getUrl(pattern[0], url) });
} else {
return null;
}
};
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:UrlPatterns.ts
示例10:
onSubmit: (api) => {
const nuData = api.getData();
const headHtml = Parser.dataToHtml(editor, Tools.extend(data, nuData), headState.get());
headState.set(headHtml);
api.close();
}
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:Dialog.ts
注:本文中的tinymce/core/api/util/Tools.extend函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论