1 | <!DOCTYPE html> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <title></title> |
---|
5 | <script type="text/javascript" src="https://raw.github.com/ckeditor/ckeditor-dev/major/ckeditor.js"></script> |
---|
6 | <script type="text/javascript"> |
---|
7 | CKEDITOR.disableAutoInline = true; |
---|
8 | CKEDITOR.dtd.$editable.span = 1; |
---|
9 | CKEDITOR.plugins.add('ref', { |
---|
10 | requires: 'widget', |
---|
11 | |
---|
12 | init: function (editor) { |
---|
13 | editor.widgets.add('ref', { |
---|
14 | editables: { text: '*' }, |
---|
15 | |
---|
16 | upcast: function (el) { |
---|
17 | return el.attributes['data-type']; |
---|
18 | }, |
---|
19 | }); |
---|
20 | } |
---|
21 | }); |
---|
22 | document.addEventListener('DOMContentLoaded', function () { |
---|
23 | CKEDITOR.inline('editor', { |
---|
24 | customConfig: '', |
---|
25 | allowedContent: true, |
---|
26 | autoParagraph: false, |
---|
27 | fillEmptyBlocks: false, |
---|
28 | |
---|
29 | extraPlugins: 'ref', |
---|
30 | }); |
---|
31 | }); |
---|
32 | </script> |
---|
33 | </head> |
---|
34 | <body> |
---|
35 | <div contenteditable="true" id="editor"> |
---|
36 | <p>Content before widget <span data-type="yes">inline widget content</span> content after widget</p> |
---|
37 | </body> |
---|
38 | </html> |
---|