本文整理匯總了TypeScript中@ephox/snooker.TableRender.render方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript TableRender.render方法的具體用法?TypeScript TableRender.render怎麽用?TypeScript TableRender.render使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/snooker.TableRender
的用法示例。
在下文中一共展示了TableRender.render方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
const insert = function (editor, columns, rows) {
let tableElm;
const renderedHtml = TableRender.render(rows, columns, 0, 0);
Attr.set(renderedHtml, 'id', '__mce');
const html = Html.getOuter(renderedHtml);
editor.insertContent(html);
tableElm = editor.dom.get('__mce');
editor.dom.setAttrib(tableElm, 'id', null);
editor.$('tr', tableElm).each(function (index, row) {
editor.fire('newrow', {
node: row
});
editor.$('th,td', row).each(function (index, cell) {
editor.fire('newcell', {
node: cell
});
});
});
editor.dom.setAttribs(tableElm, editor.settings.table_default_attributes || {});
editor.dom.setStyles(tableElm, editor.settings.table_default_styles || {});
selectFirstCellInTable(editor, Element.fromDom(tableElm));
return tableElm;
};
示例2: getDefaultStyles
const insert = (editor: Editor, columns: number, rows: number): HTMLElement => {
const defaultStyles = getDefaultStyles(editor);
const options: TableRender.RenderOptions = {
styles: defaultStyles,
attributes: getDefaultAttributes(editor),
percentages: isPercentage(defaultStyles.width) && !isPixelsForced(editor)
};
const table = TableRender.render(rows, columns, 0, 0, options);
Attr.set(table, 'data-mce-id', '__mce');
const html = Html.getOuter(table);
editor.insertContent(html);
return SelectorFind.descendant(Util.getBody(editor), 'table[data-mce-id="__mce"]').map((table) => {
if (isPixelsForced(editor)) {
Css.set(table, 'width', Css.get(table, 'width'));
}
Attr.remove(table, 'data-mce-id');
fireEvents(editor, table);
selectFirstCellInTable(editor, table);
return table.dom();
}).getOr(null);
};