overtype 1.2.7 → 2.0.0
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.
- package/README.md +222 -34
- package/dist/overtype-webcomponent.esm.js +4763 -0
- package/dist/overtype-webcomponent.esm.js.map +7 -0
- package/dist/overtype-webcomponent.js +4785 -0
- package/dist/overtype-webcomponent.js.map +7 -0
- package/dist/overtype-webcomponent.min.js +991 -0
- package/dist/overtype.cjs +682 -389
- package/dist/overtype.cjs.map +4 -4
- package/dist/overtype.d.ts +57 -14
- package/dist/overtype.esm.js +679 -388
- package/dist/overtype.esm.js.map +4 -4
- package/dist/overtype.js +679 -388
- package/dist/overtype.js.map +4 -4
- package/dist/overtype.min.js +157 -125
- package/package.json +18 -4
- package/src/link-tooltip.js +48 -73
- package/src/overtype-webcomponent.js +676 -0
- package/src/overtype.d.ts +57 -14
- package/src/overtype.js +186 -59
- package/src/parser.js +120 -17
- package/src/styles.js +92 -30
- package/src/toolbar-buttons.js +163 -0
- package/src/toolbar.js +194 -249
- package/diagram.png +0 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toolbar button definitions for OverType editor
|
|
3
|
+
* Export built-in buttons that can be used in custom toolbar configurations
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as icons from './icons.js';
|
|
7
|
+
import * as markdownActions from 'markdown-actions';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Built-in toolbar button definitions
|
|
11
|
+
* Each button has: name, icon, title, action
|
|
12
|
+
* Action signature: ({ editor, getValue, setValue, event }) => void
|
|
13
|
+
*/
|
|
14
|
+
export const toolbarButtons = {
|
|
15
|
+
bold: {
|
|
16
|
+
name: 'bold',
|
|
17
|
+
icon: icons.boldIcon,
|
|
18
|
+
title: 'Bold (Ctrl+B)',
|
|
19
|
+
action: ({ editor, event }) => {
|
|
20
|
+
markdownActions.toggleBold(editor.textarea);
|
|
21
|
+
editor.textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
italic: {
|
|
26
|
+
name: 'italic',
|
|
27
|
+
icon: icons.italicIcon,
|
|
28
|
+
title: 'Italic (Ctrl+I)',
|
|
29
|
+
action: ({ editor, event }) => {
|
|
30
|
+
markdownActions.toggleItalic(editor.textarea);
|
|
31
|
+
editor.textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
code: {
|
|
36
|
+
name: 'code',
|
|
37
|
+
icon: icons.codeIcon,
|
|
38
|
+
title: 'Inline Code',
|
|
39
|
+
action: ({ editor, event }) => {
|
|
40
|
+
markdownActions.toggleCode(editor.textarea);
|
|
41
|
+
editor.textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
separator: {
|
|
46
|
+
name: 'separator'
|
|
47
|
+
// No icon, title, or action - special separator element
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
link: {
|
|
51
|
+
name: 'link',
|
|
52
|
+
icon: icons.linkIcon,
|
|
53
|
+
title: 'Insert Link',
|
|
54
|
+
action: ({ editor, event }) => {
|
|
55
|
+
markdownActions.insertLink(editor.textarea);
|
|
56
|
+
editor.textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
h1: {
|
|
61
|
+
name: 'h1',
|
|
62
|
+
icon: icons.h1Icon,
|
|
63
|
+
title: 'Heading 1',
|
|
64
|
+
action: ({ editor, event }) => {
|
|
65
|
+
markdownActions.toggleH1(editor.textarea);
|
|
66
|
+
editor.textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
h2: {
|
|
71
|
+
name: 'h2',
|
|
72
|
+
icon: icons.h2Icon,
|
|
73
|
+
title: 'Heading 2',
|
|
74
|
+
action: ({ editor, event }) => {
|
|
75
|
+
markdownActions.toggleH2(editor.textarea);
|
|
76
|
+
editor.textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
h3: {
|
|
81
|
+
name: 'h3',
|
|
82
|
+
icon: icons.h3Icon,
|
|
83
|
+
title: 'Heading 3',
|
|
84
|
+
action: ({ editor, event }) => {
|
|
85
|
+
markdownActions.toggleH3(editor.textarea);
|
|
86
|
+
editor.textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
bulletList: {
|
|
91
|
+
name: 'bulletList',
|
|
92
|
+
icon: icons.bulletListIcon,
|
|
93
|
+
title: 'Bullet List',
|
|
94
|
+
action: ({ editor, event }) => {
|
|
95
|
+
markdownActions.toggleBulletList(editor.textarea);
|
|
96
|
+
editor.textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
orderedList: {
|
|
101
|
+
name: 'orderedList',
|
|
102
|
+
icon: icons.orderedListIcon,
|
|
103
|
+
title: 'Numbered List',
|
|
104
|
+
action: ({ editor, event }) => {
|
|
105
|
+
markdownActions.toggleNumberedList(editor.textarea);
|
|
106
|
+
editor.textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
taskList: {
|
|
111
|
+
name: 'taskList',
|
|
112
|
+
icon: icons.taskListIcon,
|
|
113
|
+
title: 'Task List',
|
|
114
|
+
action: ({ editor, event }) => {
|
|
115
|
+
if (markdownActions.toggleTaskList) {
|
|
116
|
+
markdownActions.toggleTaskList(editor.textarea);
|
|
117
|
+
editor.textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
quote: {
|
|
123
|
+
name: 'quote',
|
|
124
|
+
icon: icons.quoteIcon,
|
|
125
|
+
title: 'Quote',
|
|
126
|
+
action: ({ editor, event }) => {
|
|
127
|
+
markdownActions.toggleQuote(editor.textarea);
|
|
128
|
+
editor.textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
viewMode: {
|
|
133
|
+
name: 'viewMode',
|
|
134
|
+
icon: icons.eyeIcon,
|
|
135
|
+
title: 'View mode'
|
|
136
|
+
// Special: handled internally by Toolbar class as dropdown
|
|
137
|
+
// No action property - dropdown behavior is internal
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Default toolbar button layout with separators
|
|
143
|
+
* This is used when toolbar: true but no toolbarButtons provided
|
|
144
|
+
*/
|
|
145
|
+
export const defaultToolbarButtons = [
|
|
146
|
+
toolbarButtons.bold,
|
|
147
|
+
toolbarButtons.italic,
|
|
148
|
+
toolbarButtons.code,
|
|
149
|
+
toolbarButtons.separator,
|
|
150
|
+
toolbarButtons.link,
|
|
151
|
+
toolbarButtons.separator,
|
|
152
|
+
toolbarButtons.h1,
|
|
153
|
+
toolbarButtons.h2,
|
|
154
|
+
toolbarButtons.h3,
|
|
155
|
+
toolbarButtons.separator,
|
|
156
|
+
toolbarButtons.bulletList,
|
|
157
|
+
toolbarButtons.orderedList,
|
|
158
|
+
toolbarButtons.taskList,
|
|
159
|
+
toolbarButtons.separator,
|
|
160
|
+
toolbarButtons.quote,
|
|
161
|
+
toolbarButtons.separator,
|
|
162
|
+
toolbarButtons.viewMode
|
|
163
|
+
];
|