tiptapify 0.0.1 → 0.0.4

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.
@@ -35,7 +35,7 @@ import { common, createLowlight } from 'lowlight'
35
35
  // using all available languages
36
36
  const lowlight = createLowlight(common)
37
37
 
38
- // or you can register specific languages
38
+ // or register specific languages
39
39
  // const lowlight = createLowlight()
40
40
  //
41
41
  // import language example
@@ -44,55 +44,60 @@ const lowlight = createLowlight(common)
44
44
  // register language example
45
45
  // lowlight.register('ts', ts)
46
46
 
47
- export const editorExtensions = (placeholder: string = '') => [
48
- TextStyleKit,
49
- Document,
50
- Text,
51
- Paragraph,
52
- Heading,
53
- Bold,
54
- Italic,
55
- Strike,
56
- Blockquote,
57
- OrderedList,
58
- BulletList,
59
- TaskList,
60
- TaskItem,
61
- ListItem,
62
- ListKeymap,
63
- HardBreak,
64
- HorizontalRule,
65
- Dropcursor,
66
- Typography,
67
- Underline,
68
- Highlight,
69
- Link.configure({
70
- openOnClick: false,
71
- defaultProtocol: 'https',
72
- }),
73
- Image,
74
- Superscript,
75
- Subscript,
76
- TableKit,
77
- Code,
78
- UndoRedo,
79
- Focus,
80
- CodeBlockLowlight
81
- .extend({
82
- addNodeView() {
83
- return VueNodeViewRenderer(CodeBlockComponent)
84
- },
85
- })
86
- .configure({ lowlight }),
87
- Selection.configure({
88
- className: 'selection',
89
- }),
90
- TextAlign.configure({
91
- types: ['heading', 'paragraph'],
92
- }),
93
- Placeholder.configure({ placeholder }),
94
- SlashCommands.configure({
95
- suggestion,
96
- }),
97
- CharacterCount
98
- ]
47
+ export function editorExtensions (placeholder: string, slashCommands: boolean) {
48
+ const extensions = [
49
+ TextStyleKit,
50
+ Document,
51
+ Text,
52
+ Paragraph,
53
+ Heading,
54
+ Bold,
55
+ Italic,
56
+ Strike,
57
+ Blockquote,
58
+ OrderedList,
59
+ BulletList,
60
+ TaskList,
61
+ TaskItem,
62
+ ListItem,
63
+ ListKeymap,
64
+ HardBreak,
65
+ HorizontalRule,
66
+ Dropcursor,
67
+ Typography,
68
+ Underline,
69
+ Highlight,
70
+ Link.configure({
71
+ openOnClick: false,
72
+ defaultProtocol: 'https',
73
+ }),
74
+ Image,
75
+ Superscript,
76
+ Subscript,
77
+ TableKit,
78
+ Code,
79
+ UndoRedo,
80
+ Focus,
81
+ CodeBlockLowlight
82
+ .extend({
83
+ addNodeView() {
84
+ return VueNodeViewRenderer(CodeBlockComponent)
85
+ },
86
+ })
87
+ .configure({ lowlight }),
88
+ Selection.configure({
89
+ className: 'selection',
90
+ }),
91
+ TextAlign.configure({
92
+ types: ['heading', 'paragraph'],
93
+ }),
94
+ Placeholder.configure({ placeholder }),
95
+ CharacterCount
96
+ ]
97
+
98
+ if (slashCommands) {
99
+ extensions.push(SlashCommands.configure({ suggestion }))
100
+ }
101
+
102
+ return extensions
103
+ }
@@ -4,12 +4,12 @@ import { editorExtensions } from '@tiptapify/components/editorExtensions'
4
4
 
5
5
  let editorInstance: any = null
6
6
 
7
- export function useEditor(content: any = '', placeholder: string = '') {
7
+ export function useEditor(content: any = '', placeholder: string = '', slashCommands: boolean = true) {
8
8
  class TiptapifyEditor {
9
9
  private editor
10
10
 
11
11
  constructor() {
12
- const extensions = editorExtensions(placeholder)
12
+ const extensions = editorExtensions(placeholder, slashCommands)
13
13
  this.editor = useEditorOriginal({
14
14
  content,
15
15
  extensions,
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "style": {
3
3
  "heading": "heading",
4
+ "headings": {
5
+ "h1": "heading level 1",
6
+ "h2": "heading level 2",
7
+ "h3": "heading level 3",
8
+ "h4": "heading level 4",
9
+ "h5": "heading level 5",
10
+ "h6": "heading level 6"
11
+ },
4
12
  "fontFamily": "font family",
5
13
  "fontSize": "font size",
6
14
  "lineHeight": "line height"
@@ -18,8 +26,8 @@
18
26
  "blockquote": "cite",
19
27
  "code": "code",
20
28
  "codeblock": "code block",
21
- "codeblock_syntax": "code block w/ syntax highlighting",
22
- "link": "external link"
29
+ "link": "external link",
30
+ "formatClear": "format clear"
23
31
  },
24
32
  "action": {
25
33
  "undo": "undo",
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "style": {
3
3
  "heading": "заголовок",
4
+ "headings": {
5
+ "h1": "заголовок 1-го уровня",
6
+ "h2": "заголовок 2-го уровня",
7
+ "h3": "заголовок 3-го уровня",
8
+ "h4": "заголовок 4-го уровня",
9
+ "h5": "заголовок 5-го уровня",
10
+ "h6": "заголовок 6-го уровня"
11
+ },
4
12
  "fontFamily": "шрифт",
5
13
  "fontSize": "размер",
6
14
  "lineHeight": "высота строки"
@@ -18,8 +26,8 @@
18
26
  "blockquote": "цитата",
19
27
  "code": "код",
20
28
  "codeblock": "блок кода",
21
- "codeblock_syntax": "блок кода с подсветкой синтаксиса",
22
- "link": "внешняя ссылка"
29
+ "link": "внешняя ссылка",
30
+ "formatClear": "очистить форматирование"
23
31
  },
24
32
  "action": {
25
33
  "undo": "отмена",
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "style": {
3
3
  "heading": "заголовок",
4
+ "headings": {
5
+ "h1": "заголовок 1-го рівня",
6
+ "h2": "заголовок 2-го рівня",
7
+ "h3": "заголовок 3-го рівня",
8
+ "h4": "заголовок 4-го рівня",
9
+ "h5": "заголовок 5-го рівня",
10
+ "h6": "заголовок 6-го рівня"
11
+ },
4
12
  "fontFamily": "шрифт",
5
13
  "fontSize": "розмір",
6
14
  "lineHeight": "висота строки"
@@ -18,8 +26,8 @@
18
26
  "blockquote": "цитата",
19
27
  "code": "код",
20
28
  "codeblock": "блок коду",
21
- "codeblock_syntax": "блок коду з підсвіткою синтаксиса",
22
- "link": "зовнішнє посилання"
29
+ "link": "зовнішнє посилання",
30
+ "formatClear": "очистити форматування"
23
31
  },
24
32
  "action": {
25
33
  "undo": "відміна",