本文整理汇总了TypeScript中@ephox/sugar.Html.getOuter方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Html.getOuter方法的具体用法?TypeScript Html.getOuter怎么用?TypeScript Html.getOuter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/sugar.Html
的用法示例。
在下文中一共展示了Html.getOuter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: function
const assertPath = function (label, root, expPath, expOffset, actElement, actOffset) {
const expected = Cursors.calculateOne(root, expPath);
const message = function () {
const actual = Element.fromDom(actElement);
const actPath = Hierarchy.path(root, actual).getOrDie('could not find path to root');
return 'Expected path: ' + JSON.stringify(expPath) + '.\nActual path: ' + JSON.stringify(actPath);
};
Assertions.assertEq('Assert incorrect for ' + label + '.\n' + message(), true, expected.dom() === actElement);
Assertions.assertEq('Offset mismatch for ' + label + ' in :\n' + Html.getOuter(expected), expOffset, actOffset);
};
示例3: 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);
};
示例4:
return Chain.op(function (tableModel) {
const actualHtml = Html.getOuter(SimpleTableModel.toDom(tableModel));
Assertions.assertHtml('Should be expected table html', expectedHtml, actualHtml);
});
示例5: function
function (table) {
return Result.value(Html.getOuter(table));
},
示例6:
Step.sync(function () {
const elm = Element.fromHtml('<p>a</p>');
PaddingBr.fillWithPaddingBr(elm);
Assertions.assertHtml('Should be padded with bogus br', '<p><br data-mce-bogus="1"></p>', Html.getOuter(elm));
})