diff options
author | Abdullah Ahmed <abdullah_ahmed@brown.edu> | 2019-06-15 20:09:41 -0400 |
---|---|---|
committer | Abdullah Ahmed <abdullah_ahmed@brown.edu> | 2019-06-15 20:09:41 -0400 |
commit | 881df5e1255681a306af2d9f78b092b3688ad38c (patch) | |
tree | b456f0e559eba0c03f937111d1b15bbf08495fc9 /src/client/util/RichTextSchema.tsx | |
parent | c22feda3d2df8f6814c0837ea18ad293975ae2e4 (diff) | |
parent | 618d3717e118f978de976cb34e8bc2051c726ffc (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into text_box_ab
Diffstat (limited to 'src/client/util/RichTextSchema.tsx')
-rw-r--r-- | src/client/util/RichTextSchema.tsx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx index 8c56a32e8..3078e0bbc 100644 --- a/src/client/util/RichTextSchema.tsx +++ b/src/client/util/RichTextSchema.tsx @@ -140,6 +140,32 @@ export const nodes: { [index: string]: NodeSpec } = { } }, + video: { + inline: true, + attrs: { + src: {}, + width: { default: "100px" }, + alt: { default: null }, + title: { default: null } + }, + group: "inline", + draggable: true, + parseDOM: [{ + tag: "video[src]", getAttrs(dom: any) { + return { + src: dom.getAttribute("src"), + title: dom.getAttribute("title"), + alt: dom.getAttribute("alt"), + width: Math.min(100, Number(dom.getAttribute("width"))), + } + } + }], + toDOM(node) { + const attrs = { style: `width: ${node.attrs.width}` } + return ["video", { ...node.attrs, ...attrs }] + } + }, + // :: NodeSpec A hard line break, represented in the DOM as `<br>`. hard_break: { inline: true, |