1 | import { FONT_STYLE } from '../groups';
|
2 | function getAttrFromVerticalAlign(node) {
|
3 | if (node.style.verticalAlign) {
|
4 | var type = node.style.verticalAlign.slice(0, 3);
|
5 | if (type === 'sub' || type === 'sup') {
|
6 | return { type: type };
|
7 | }
|
8 | }
|
9 | return false;
|
10 | }
|
11 | export var subsup = {
|
12 | inclusive: true,
|
13 | group: FONT_STYLE,
|
14 | attrs: { type: { default: 'sub' } },
|
15 | parseDOM: [
|
16 | { tag: 'sub', attrs: { type: 'sub' } },
|
17 | { tag: 'sup', attrs: { type: 'sup' } },
|
18 | {
|
19 |
|
20 |
|
21 | tag: 'span',
|
22 | style: 'vertical-align=super',
|
23 | getAttrs: function (node) { return getAttrFromVerticalAlign(node); },
|
24 | },
|
25 | {
|
26 | tag: 'span',
|
27 | style: 'vertical-align=sub',
|
28 | getAttrs: function (node) { return getAttrFromVerticalAlign(node); },
|
29 | },
|
30 | ],
|
31 | toDOM: function (mark) {
|
32 | return [mark.attrs.type];
|
33 | },
|
34 | };
|
35 |
|
\ | No newline at end of file |