@seorii/tiptap 0.2.22 → 0.3.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/i18n/en-us/index.js +1 -1
  2. package/dist/i18n/index.js +2 -3
  3. package/dist/i18n/ko-kr/index.js +1 -1
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.js +3 -3
  6. package/dist/plugin/command/emoji.d.ts +2 -2
  7. package/dist/plugin/command/emoji.js +7 -3
  8. package/dist/plugin/command/stores.d.ts +0 -1
  9. package/dist/plugin/command/suggest.d.ts +2 -2
  10. package/dist/plugin/command/suggest.js +85 -26
  11. package/dist/plugin/embed.js +15 -9
  12. package/dist/plugin/iframe.js +19 -10
  13. package/dist/plugin/image/dragdrop.js +10 -12
  14. package/dist/plugin/image/index.d.ts +1 -1
  15. package/dist/plugin/image/index.js +12 -8
  16. package/dist/plugin/indent.js +16 -14
  17. package/dist/plugin/orderedlist/index.js +55 -23
  18. package/dist/plugin/orderedlist/korean.scss +12 -13
  19. package/dist/plugin/orderedlist/toggleList.js +7 -7
  20. package/dist/plugin/table/deleteTable.d.ts +1 -1
  21. package/dist/plugin/table/deleteTable.js +2 -2
  22. package/dist/plugin/table/index.js +10 -6
  23. package/dist/plugin/table/style/cell.scss +14 -13
  24. package/dist/plugin/table/style/grip.scss +61 -59
  25. package/dist/plugin/table/style/resize.scss +21 -23
  26. package/dist/plugin/table/style/table.scss +72 -69
  27. package/dist/plugin/table/tableCell/index.js +6 -6
  28. package/dist/plugin/table/tableHeader/index.js +6 -6
  29. package/dist/plugin/table/tableRow/index.js +1 -1
  30. package/dist/plugin/table/util.d.ts +2 -2
  31. package/dist/plugin/table/util.js +9 -9
  32. package/dist/plugin/youtube.d.ts +2 -2
  33. package/dist/plugin/youtube.js +35 -26
  34. package/dist/tiptap/Bubble.svelte +199 -95
  35. package/dist/tiptap/Bubble.svelte.d.ts +7 -21
  36. package/dist/tiptap/Command.svelte +125 -59
  37. package/dist/tiptap/Command.svelte.d.ts +4 -16
  38. package/dist/tiptap/Floating.svelte +67 -41
  39. package/dist/tiptap/Floating.svelte.d.ts +2 -14
  40. package/dist/tiptap/TipTap.svelte +210 -132
  41. package/dist/tiptap/TipTap.svelte.d.ts +18 -34
  42. package/dist/tiptap/ToolbarButton.svelte +33 -21
  43. package/dist/tiptap/ToolbarButton.svelte.d.ts +10 -25
  44. package/dist/tiptap/index.d.ts +1 -1
  45. package/dist/tiptap/index.js +2 -2
  46. package/dist/tiptap/setMath.js +5 -2
  47. package/dist/tiptap/tiptap.d.ts +2 -2
  48. package/dist/tiptap/tiptap.js +87 -76
  49. package/package.json +109 -102
@@ -42,5 +42,5 @@ export default {
42
42
  blockquoteInfo: 'Blockquote',
43
43
  newLineInfo: 'Press / to enter commands. Or',
44
44
  placeholder: 'Enter content here...',
45
- insertCode: 'Insert code',
45
+ insertCode: 'Insert code'
46
46
  };
@@ -1,12 +1,11 @@
1
1
  import enUs from './en-us/index';
2
2
  import koKr from './ko-kr/index';
3
- import { browser } from "$app/environment";
4
3
  const locales = [enUs, koKr];
5
4
  export function getLocale(locales) {
6
5
  if (typeof navigator === 'undefined')
7
6
  return enUs;
8
7
  const language = navigator.language;
9
- const locale = locales.find(item => item.target.includes(language));
8
+ const locale = locales.find((item) => item.target.includes(language));
10
9
  return locale || enUs;
11
10
  }
12
11
  const locale = getLocale(locales);
@@ -18,5 +17,5 @@ export default function i18n(...args) {
18
17
  i18n.locale = locale;
19
18
  i18n.localeLangCountry = i18n('lang') + '-' + i18n('country');
20
19
  //@ts-ignore
21
- if (browser)
20
+ if (typeof window !== 'undefined')
22
21
  window.__me_i18n = i18n;
@@ -42,5 +42,5 @@ export default {
42
42
  blockquoteInfo: '있어보이는 인용구 삽입',
43
43
  newLineInfo: '/로 명령어 입력. 또는',
44
44
  placeholder: '내용을 입력하세요...',
45
- insertCode: '코드 삽입',
45
+ insertCode: '코드 삽입'
46
46
  };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export default TipTap;
2
2
  export { getDetail };
3
- import TipTap from "./tiptap/index.js";
4
- import { getDetail } from "./plugin/command/suggest.js";
3
+ import TipTap from './tiptap/index.js';
4
+ import { getDetail } from './plugin/command/suggest.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Reexport your entry components here
2
- import TipTap from "./tiptap/index.js";
3
- import {getDetail} from "./plugin/command/suggest.js";
2
+ import TipTap from './tiptap/index.js';
3
+ import { getDetail } from './plugin/command/suggest.js';
4
4
 
5
5
  export default TipTap;
6
- export {getDetail};
6
+ export { getDetail };
@@ -1,5 +1,5 @@
1
- import { PluginKey } from "prosemirror-state";
2
- import type { Editor } from "@tiptap/core";
1
+ import { PluginKey } from 'prosemirror-state';
2
+ import type { Editor } from '@tiptap/core';
3
3
  export declare const emoji: {
4
4
  pluginKey: PluginKey<any>;
5
5
  char: string;
@@ -1,6 +1,6 @@
1
1
  import { slashVisible, slashItems, slashLocaltion, slashProps, slashDetail } from './stores';
2
- import { PluginKey } from "prosemirror-state";
3
- import Suggestion from "@tiptap/suggestion";
2
+ import { PluginKey } from 'prosemirror-state';
3
+ import Suggestion from '@tiptap/suggestion';
4
4
  //@ts-ignore
5
5
  import emojis from 'emojis-list';
6
6
  //@ts-ignore
@@ -43,7 +43,11 @@ export const emoji = {
43
43
  filtered.push({
44
44
  title: emojis[i] + ' ' + tags[i],
45
45
  command: ({ editor, range }) => {
46
- editor.chain().deleteRange(fixRange(editor, range, ':')).insertContent(emojis[i] + ' ').run();
46
+ editor
47
+ .chain()
48
+ .deleteRange(fixRange(editor, range, ':'))
49
+ .insertContent(emojis[i] + ' ')
50
+ .run();
47
51
  }
48
52
  });
49
53
  if (filtered.length >= max)
@@ -1,4 +1,3 @@
1
- /// <reference types="svelte" />
2
1
  export declare const slashVisible: import("svelte/store").Writable<boolean>;
3
2
  export declare const slashItems: import("svelte/store").Writable<never[]>;
4
3
  export declare const slashLocaltion: import("svelte/store").Writable<{
@@ -1,5 +1,5 @@
1
- import { PluginKey } from "prosemirror-state";
2
- import { Editor } from "@tiptap/core";
1
+ import { PluginKey } from 'prosemirror-state';
2
+ import { Editor } from '@tiptap/core';
3
3
  export declare function getDetail(editor: any, range: any, opt: any): void;
4
4
  export declare const suggest: {
5
5
  pluginKey: PluginKey<any>;
@@ -1,9 +1,9 @@
1
1
  import { slashVisible, slashItems, slashLocaltion, slashProps, slashDetail, slashSelection } from './stores';
2
- import i18n from "../../i18n";
3
- import { fallbackUpload } from "../image/dragdrop";
4
- import { PluginKey } from "prosemirror-state";
5
- import { Editor } from "@tiptap/core";
6
- import Suggestion from "@tiptap/suggestion";
2
+ import i18n from '../../i18n';
3
+ import { fallbackUpload } from '../image/dragdrop';
4
+ import { PluginKey } from 'prosemirror-state';
5
+ import { Editor } from '@tiptap/core';
6
+ import Suggestion from '@tiptap/suggestion';
7
7
  function fixRange(editor, range, split = '/') {
8
8
  const { state } = editor.view, { selection, doc } = state;
9
9
  if (selection.$to.nodeBefore?.text?.includes?.(split)) {
@@ -40,13 +40,19 @@ export const suggest = {
40
40
  items: ({ query }) => {
41
41
  const raw = [
42
42
  {
43
- section: i18n('text'), list: [
43
+ section: i18n('text'),
44
+ list: [
44
45
  {
45
46
  icon: 'title',
46
47
  title: i18n('title') + ' 1',
47
48
  subtitle: i18n('title1Info'),
48
49
  command: ({ editor, range }) => {
49
- editor.chain().focus().deleteRange(fixRange(editor, range)).setNode('heading', { level: 1 }).run();
50
+ editor
51
+ .chain()
52
+ .focus()
53
+ .deleteRange(fixRange(editor, range))
54
+ .setNode('heading', { level: 1 })
55
+ .run();
50
56
  }
51
57
  },
52
58
  {
@@ -54,7 +60,12 @@ export const suggest = {
54
60
  title: i18n('title') + ' 2',
55
61
  subtitle: i18n('title2Info'),
56
62
  command: ({ editor, range }) => {
57
- editor.chain().focus().deleteRange(fixRange(editor, range)).setNode('heading', { level: 2 }).run();
63
+ editor
64
+ .chain()
65
+ .focus()
66
+ .deleteRange(fixRange(editor, range))
67
+ .setNode('heading', { level: 2 })
68
+ .run();
58
69
  }
59
70
  },
60
71
  {
@@ -62,7 +73,12 @@ export const suggest = {
62
73
  title: i18n('title') + ' 3',
63
74
  subtitle: i18n('title3Info'),
64
75
  command: ({ editor, range }) => {
65
- editor.chain().focus().deleteRange(fixRange(editor, range)).setNode('heading', { level: 3 }).run();
76
+ editor
77
+ .chain()
78
+ .focus()
79
+ .deleteRange(fixRange(editor, range))
80
+ .setNode('heading', { level: 3 })
81
+ .run();
66
82
  }
67
83
  },
68
84
  {
@@ -86,8 +102,9 @@ export const suggest = {
86
102
  ]
87
103
  },
88
104
  {
89
- section: i18n('block'), list: [
90
- ...(window.__tiptap_blocks),
105
+ section: i18n('block'),
106
+ list: [
107
+ ...window.__tiptap_blocks,
91
108
  {
92
109
  icon: 'image',
93
110
  title: i18n('image'),
@@ -115,8 +132,14 @@ export const suggest = {
115
132
  title: i18n('codeBlock'),
116
133
  subtitle: i18n('codeBlockInfo'),
117
134
  command: ({ editor, range }) => getDetail(editor, range, {
118
- type: 'code', handler: (input) => {
119
- editor.chain().focus().deleteRange(fixRange(editor, range - 1)).setNode('codeBlock', { language: input }).run();
135
+ type: 'code',
136
+ handler: (input) => {
137
+ editor
138
+ .chain()
139
+ .focus()
140
+ .deleteRange(fixRange(editor, range - 1))
141
+ .setNode('codeBlock', { language: input })
142
+ .run();
120
143
  }
121
144
  })
122
145
  },
@@ -126,7 +149,13 @@ export const suggest = {
126
149
  subtitle: i18n('mathBlockInfo'),
127
150
  command: ({ editor, range }) => {
128
151
  const { to } = range;
129
- editor.chain().focus().deleteRange(fixRange(editor, range)).setNode('math_display').focus().run();
152
+ editor
153
+ .chain()
154
+ .focus()
155
+ .deleteRange(fixRange(editor, range))
156
+ .setNode('math_display')
157
+ .focus()
158
+ .run();
130
159
  }
131
160
  },
132
161
  {
@@ -134,10 +163,15 @@ export const suggest = {
134
163
  title: i18n('table'),
135
164
  subtitle: i18n('tableInfo'),
136
165
  command: ({ editor, range }) => {
137
- editor.chain().focus().deleteRange(fixRange(editor, range)).insertTable({
166
+ editor
167
+ .chain()
168
+ .focus()
169
+ .deleteRange(fixRange(editor, range))
170
+ .insertTable({
138
171
  rows: 2,
139
172
  cols: 3
140
- }).run();
173
+ })
174
+ .run();
141
175
  }
142
176
  },
143
177
  {
@@ -145,7 +179,13 @@ export const suggest = {
145
179
  title: i18n('blockquote'),
146
180
  subtitle: i18n('blockquoteInfo'),
147
181
  command: ({ editor, range }) => {
148
- editor.chain().focus().deleteRange(fixRange(editor, range)).setBlockquote().focus().run();
182
+ editor
183
+ .chain()
184
+ .focus()
185
+ .deleteRange(fixRange(editor, range))
186
+ .setBlockquote()
187
+ .focus()
188
+ .run();
149
189
  }
150
190
  },
151
191
  {
@@ -153,11 +193,20 @@ export const suggest = {
153
193
  title: i18n('iframe'),
154
194
  subtitle: i18n('iframeInfo'),
155
195
  command: ({ editor, range }) => getDetail(editor, range, {
156
- title: 'iframe', placeholder: 'url', handler: (input) => {
157
- editor.chain().focus().insertContent([{
196
+ title: 'iframe',
197
+ placeholder: 'url',
198
+ handler: (input) => {
199
+ editor
200
+ .chain()
201
+ .focus()
202
+ .insertContent([
203
+ {
158
204
  type: 'iframe',
159
205
  attrs: { src: input }
160
- }, { type: 'paragraph' }]).run();
206
+ },
207
+ { type: 'paragraph' }
208
+ ])
209
+ .run();
161
210
  }
162
211
  })
163
212
  },
@@ -166,18 +215,28 @@ export const suggest = {
166
215
  title: i18n('youtube'),
167
216
  subtitle: i18n('youtubeInfo'),
168
217
  command: ({ editor, range }) => getDetail(editor, range, {
169
- title: 'youtube', placeholder: 'url', handler: (input) => {
170
- editor.chain().focus().insertVideoPlayer({ url: input }).insertContent('\n').run();
218
+ title: 'youtube',
219
+ placeholder: 'url',
220
+ handler: (input) => {
221
+ editor
222
+ .chain()
223
+ .focus()
224
+ .insertVideoPlayer({ url: input })
225
+ .insertContent('\n')
226
+ .run();
171
227
  }
172
228
  })
173
229
  }
174
230
  ]
175
231
  }
176
232
  ];
177
- const filtered = raw.map(({ section, list }) => ({
178
- section, list: list.filter((item) => item.title.toLowerCase().includes(query.toLowerCase())
179
- || item.subtitle.toLowerCase().includes(query.toLowerCase()))
180
- })).filter(({ list }) => list.length > 0);
233
+ const filtered = raw
234
+ .map(({ section, list }) => ({
235
+ section,
236
+ list: list.filter((item) => item.title.toLowerCase().includes(query.toLowerCase()) ||
237
+ item.subtitle.toLowerCase().includes(query.toLowerCase()))
238
+ }))
239
+ .filter(({ list }) => list.length > 0);
181
240
  return filtered;
182
241
  },
183
242
  render: () => {
@@ -7,8 +7,8 @@ export default Node.create({
7
7
  return {
8
8
  allowFullscreen: true,
9
9
  HTMLAttributes: {
10
- class: 'embed-wrapper',
11
- },
10
+ class: 'embed-wrapper'
11
+ }
12
12
  };
13
13
  },
14
14
  addAttributes() {
@@ -17,7 +17,7 @@ export default Node.create({
17
17
  frameborder: { default: 0 },
18
18
  allowfullscreen: {
19
19
  default: this.options.allowFullscreen,
20
- parseHTML: () => this.options.allowFullscreen,
20
+ parseHTML: () => this.options.allowFullscreen
21
21
  },
22
22
  width: { default: '100%' },
23
23
  height: { default: '800px' },
@@ -25,12 +25,18 @@ export default Node.create({
25
25
  };
26
26
  },
27
27
  parseHTML() {
28
- return [{
29
- tag: 'embed',
30
- }];
28
+ return [
29
+ {
30
+ tag: 'embed'
31
+ }
32
+ ];
31
33
  },
32
34
  renderHTML({ HTMLAttributes }) {
33
- return ['div', this.options.HTMLAttributes, ['embed', mergeAttributes(HTMLAttributes, { credentialless: true, crossorigin: "anonymous" })]];
35
+ return [
36
+ 'div',
37
+ this.options.HTMLAttributes,
38
+ ['embed', mergeAttributes(HTMLAttributes, { credentialless: true, crossorigin: 'anonymous' })]
39
+ ];
34
40
  },
35
41
  addCommands() {
36
42
  return {
@@ -40,7 +46,7 @@ export default Node.create({
40
46
  if (dispatch)
41
47
  tr.replaceRangeWith(selection.from, selection.to, node);
42
48
  return true;
43
- },
49
+ }
44
50
  };
45
- },
51
+ }
46
52
  });
@@ -7,8 +7,8 @@ export default Node.create({
7
7
  return {
8
8
  allowFullscreen: true,
9
9
  HTMLAttributes: {
10
- class: 'iframe-wrapper',
11
- },
10
+ class: 'iframe-wrapper'
11
+ }
12
12
  };
13
13
  },
14
14
  addAttributes() {
@@ -17,17 +17,26 @@ export default Node.create({
17
17
  frameborder: { default: 0 },
18
18
  allowfullscreen: {
19
19
  default: this.options.allowFullscreen,
20
- parseHTML: () => this.options.allowFullscreen,
21
- },
20
+ parseHTML: () => this.options.allowFullscreen
21
+ }
22
22
  };
23
23
  },
24
24
  parseHTML() {
25
- return [{
26
- tag: 'iframe',
27
- }];
25
+ return [
26
+ {
27
+ tag: 'iframe'
28
+ }
29
+ ];
28
30
  },
29
31
  renderHTML({ HTMLAttributes }) {
30
- return ['div', this.options.HTMLAttributes, ['iframe', mergeAttributes(HTMLAttributes, { credentialless: true, crossorigin: "anonymous" })]];
32
+ return [
33
+ 'div',
34
+ this.options.HTMLAttributes,
35
+ [
36
+ 'iframe',
37
+ mergeAttributes(HTMLAttributes, { credentialless: true, crossorigin: 'anonymous' })
38
+ ]
39
+ ];
31
40
  },
32
41
  addCommands() {
33
42
  return {
@@ -37,7 +46,7 @@ export default Node.create({
37
46
  if (dispatch)
38
47
  tr.replaceRangeWith(selection.from, selection.to, node);
39
48
  return true;
40
- },
49
+ }
41
50
  };
42
- },
51
+ }
43
52
  });
@@ -1,5 +1,5 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
- export const fallbackUpload = (async (image) => URL.createObjectURL(image));
2
+ export const fallbackUpload = async (image) => URL.createObjectURL(image);
3
3
  export const dropImagePlugin = () => {
4
4
  return new Plugin({
5
5
  props: {
@@ -15,7 +15,7 @@ export const dropImagePlugin = () => {
15
15
  if (upload && image) {
16
16
  upload(image).then((src) => {
17
17
  const node = schema.nodes.image.create({
18
- src: src,
18
+ src: src
19
19
  });
20
20
  const transaction = view.state.tr.replaceSelectionWith(node);
21
21
  view.dispatch(transaction);
@@ -26,7 +26,7 @@ export const dropImagePlugin = () => {
26
26
  const reader = new FileReader();
27
27
  reader.onload = (readerEvent) => {
28
28
  const node = schema.nodes.image.create({
29
- src: readerEvent.target?.result,
29
+ src: readerEvent.target?.result
30
30
  });
31
31
  const transaction = view.state.tr.replaceSelectionWith(node);
32
32
  view.dispatch(transaction);
@@ -40,9 +40,7 @@ export const dropImagePlugin = () => {
40
40
  },
41
41
  drop: (view, event) => {
42
42
  const upload = window.__image_uploader || fallbackUpload;
43
- const hasFiles = event.dataTransfer &&
44
- event.dataTransfer.files &&
45
- event.dataTransfer.files.length;
43
+ const hasFiles = event.dataTransfer && event.dataTransfer.files && event.dataTransfer.files.length;
46
44
  if (!hasFiles) {
47
45
  return false;
48
46
  }
@@ -54,7 +52,7 @@ export const dropImagePlugin = () => {
54
52
  const { schema } = view.state;
55
53
  const coordinates = view.posAtCoords({
56
54
  left: event.clientX,
57
- top: event.clientY,
55
+ top: event.clientY
58
56
  });
59
57
  if (!coordinates)
60
58
  return false;
@@ -62,7 +60,7 @@ export const dropImagePlugin = () => {
62
60
  const reader = new FileReader();
63
61
  if (upload) {
64
62
  const node = schema.nodes.image.create({
65
- src: await upload(image),
63
+ src: await upload(image)
66
64
  });
67
65
  const transaction = view.state.tr.insert(coordinates.pos, node);
68
66
  view.dispatch(transaction);
@@ -70,7 +68,7 @@ export const dropImagePlugin = () => {
70
68
  else {
71
69
  reader.onload = (readerEvent) => {
72
70
  const node = schema.nodes.image.create({
73
- src: readerEvent.target?.result,
71
+ src: readerEvent.target?.result
74
72
  });
75
73
  const transaction = view.state.tr.insert(coordinates.pos, node);
76
74
  view.dispatch(transaction);
@@ -79,8 +77,8 @@ export const dropImagePlugin = () => {
79
77
  }
80
78
  });
81
79
  return true;
82
- },
83
- },
84
- },
80
+ }
81
+ }
82
+ }
85
83
  });
86
84
  };
@@ -1,2 +1,2 @@
1
- declare const _default: import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any>;
1
+ declare const _default: (crossorigin?: string) => import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any>;
2
2
  export default _default;
@@ -1,19 +1,23 @@
1
- import Image from "@tiptap/extension-image";
2
- import { mergeAttributes } from "@tiptap/core";
3
- import { dropImagePlugin } from "./dragdrop";
4
- export default Image.extend({
1
+ import Image from '@tiptap/extension-image';
2
+ import { mergeAttributes } from '@tiptap/core';
3
+ import { dropImagePlugin } from './dragdrop';
4
+ export default (crossorigin = 'anonymous') => Image.extend({
5
5
  addOptions() {
6
6
  return {
7
7
  ...this.parent?.(),
8
- sizes: ["inline", "block", "left", "right"],
8
+ sizes: ['inline', 'block', 'left', 'right']
9
9
  };
10
10
  },
11
11
  parseHTML: () => [{ tag: 'img' }],
12
12
  renderHTML({ HTMLAttributes }) {
13
13
  const { style } = HTMLAttributes;
14
- return ["figure", { style }, ["img", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)]];
14
+ return [
15
+ 'figure',
16
+ { style },
17
+ ['img', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)]
18
+ ];
15
19
  },
16
20
  addProseMirrorPlugins() {
17
21
  return [dropImagePlugin()];
18
- },
19
- }).configure({ HTMLAttributes: { crossorigin: 'anonymous' } });
22
+ }
23
+ }).configure({ HTMLAttributes: { crossorigin } });
@@ -2,7 +2,7 @@
2
2
  // Sources:
3
3
  // https://github.com/ueberdosis/tiptap/issues/1036#issuecomment-981094752
4
4
  // https://github.com/django-tiptap/django_tiptap/blob/main/django_tiptap/templates/forms/tiptap_textarea.html#L453-L602
5
- import { Extension, isList, } from '@tiptap/core';
5
+ import { Extension, isList } from '@tiptap/core';
6
6
  import { TextSelection, Transaction } from 'prosemirror-state';
7
7
  export const Indent = Extension.create({
8
8
  name: 'indent',
@@ -13,7 +13,7 @@ export const Indent = Extension.create({
13
13
  minIndentLevel: 0,
14
14
  maxIndentLevel: 24 * 10,
15
15
  defaultIndentLevel: 0,
16
- HTMLAttributes: {},
16
+ HTMLAttributes: {}
17
17
  };
18
18
  },
19
19
  addGlobalAttributes() {
@@ -23,14 +23,15 @@ export const Indent = Extension.create({
23
23
  attributes: {
24
24
  indent: {
25
25
  default: this.options.defaultIndentLevel,
26
- renderHTML: (attributes) => attributes.indent ? {
27
- style: `margin-left: ${attributes.indent}px;`,
28
- } : {},
29
- parseHTML: (element) => parseInt(element.style.marginLeft, 10) ||
30
- this.options.defaultIndentLevel,
31
- },
32
- },
33
- },
26
+ renderHTML: (attributes) => attributes.indent
27
+ ? {
28
+ style: `margin-left: ${attributes.indent}px;`
29
+ }
30
+ : {},
31
+ parseHTML: (element) => parseInt(element.style.marginLeft, 10) || this.options.defaultIndentLevel
32
+ }
33
+ }
34
+ }
34
35
  ];
35
36
  },
36
37
  addCommands() {
@@ -56,7 +57,7 @@ export const Indent = Extension.create({
56
57
  }
57
58
  editor.chain().focus().run();
58
59
  return false;
59
- },
60
+ }
60
61
  };
61
62
  },
62
63
  addKeyboardShortcuts() {
@@ -65,9 +66,9 @@ export const Indent = Extension.create({
65
66
  'Shift-Tab': outdent(false),
66
67
  Backspace: outdent(true),
67
68
  'Mod-]': indent(),
68
- 'Mod-[': outdent(false),
69
+ 'Mod-[': outdent(false)
69
70
  };
70
- },
71
+ }
71
72
  });
72
73
  export const clamp = (val, min, max) => {
73
74
  if (val < min)
@@ -110,7 +111,8 @@ const indent = () => ({ editor }) => {
110
111
  return false;
111
112
  };
112
113
  const outdent = (outdentOnlyAtHead) => ({ editor }) => {
113
- if (!(isList(editor.state.doc.type.name, editor.extensionManager.extensions) || (outdentOnlyAtHead && editor.state.selection.$head.parentOffset !== 0)))
114
+ if (!(isList(editor.state.doc.type.name, editor.extensionManager.extensions) ||
115
+ (outdentOnlyAtHead && editor.state.selection.$head.parentOffset !== 0)))
114
116
  return editor.commands.outdent();
115
117
  return false;
116
118
  };