本文整理汇总了TypeScript中@rich-editor/quill/ClipboardModule.dangerouslyPasteHTML函数的典型用法代码示例。如果您正苦于以下问题:TypeScript dangerouslyPasteHTML函数的具体用法?TypeScript dangerouslyPasteHTML怎么用?TypeScript dangerouslyPasteHTML使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dangerouslyPasteHTML函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("can paste some images", () => {
const html = `
<p><img src="/image1.png" alt="image-1"></p>
<img src="/image-no-alt.jpg">
<div class="js-embed embedResponsive" contenteditable="false">
<div class="embedExternal embedImage">
<div class="embed-focusableElement embedExternal-content" aria-label="External embed content - image" tabindex="-1">
<a class="embedImage-link" href="/embed-image.jpg" rel="nofollow noopener">
<img class="embedImage-img" src="/embed-image.jpg" alt="image">
</a>
</div>
</div>
<span class="sr-only">Embed Description</span>
</div>
`;
clipboard.dangerouslyPasteHTML(html);
expect(quill.getContents().ops).deep.eq([
OpUtils.image("/image1.png", "image-1"),
OpUtils.newline(),
OpUtils.image("/image-no-alt.jpg", null),
OpUtils.image("/embed-image.jpg", "image"),
OpUtils.newline(),
]);
});
示例2: expect
const testSimplePaste = (value: string | string[]) => {
let text = value;
let expected = text + "\n";
if (isArray(text)) {
[text, expected] = value;
expected = expected === undefined ? text + "\n" : expected + "\n";
}
clipboard.dangerouslyPasteHTML(text);
expect(quill.getContents().ops).deep.eq([{ insert: expected }]);
};