You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**autoDownloadFontAwesome**: If set to `true`, force downloads Font Awesome (used for icons). If set to `false`, prevents downloading. Defaults to `undefined`, which will intelligently check whether Font Awesome has already been included, then download accordingly.
4
4
-**autofocus**: If set to `true`, autofocuses the editor. Defaults to `false`.
@@ -15,7 +15,7 @@
15
15
-**hideIcons**: An array of icon names to hide. Can be used to hide specific icons shown by default without completely customizing the toolbar.
16
16
-**indentWithTabs**: If set to `false`, indent using spaces instead of tabs. Defaults to `true`.
17
17
-**initialValue**: If set, will customize the initial value of the editor.
18
-
-**insertTexts**: Customize how certain buttons that insert text behave. Takes an array with two elements. The first element will be the text inserted before the cursor or highlight, and the second element will be inserted after. For example, this is the default link value: `["[", "](http://)"]`.
18
+
-**insertTexts**: Customize how certain buttons that insert text behave. Takes an array with two elements. The first element will be the text inserted before the cursor or highlight, and the second element will be inserted after. For example, this is the default link value: `['[', '](http://)']`.
19
19
- horizontalRule
20
20
- image
21
21
- link
@@ -30,7 +30,7 @@
30
30
-**promptURLs**: If set to `true`, a JS alert window appears asking for the link or image URL. Defaults to `false`.
31
31
-**renderingConfig**: Adjust settings for parsing the Markdown during previewing (not editing).
32
32
-**singleLineBreaks**: If set to `false`, disable parsing GFM single line breaks. Defaults to `true`.
33
-
-**codeSyntaxHighlighting**: If set to `true`, will highlight using [highlight.js](https://github.com/isagalaev/highlight.js). Defaults to `false`. To use this feature you must include highlight.js on your page. For example, include the script and the CSS files like:<br>`<script src="https://cdn.jsdelivr.net/highlight.js/latest/highlight.min.js"></script>`<br>`<link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/latest/styles/github.min.css">`
33
+
-**codeSyntaxHighlighting**: If set to `true`, will highlight using [highlight.js](https://github.com/isagalaev/highlight.js). Defaults to `false`. To use this feature you must include highlight.js on your page. For example, include the script and the CSS files like:<br>`<script src='https://cdn.jsdelivr.net/highlight.js/latest/highlight.min.js'></script>`<br>`<link rel='stylesheet' href='https://cdn.jsdelivr.net/highlight.js/latest/styles/github.min.css'>`
34
34
-**shortcuts**: Keyboard shortcuts associated with this instance. Defaults to the [array of shortcuts](#keyboard-shortcuts).
35
35
-**showIcons**: An array of icon names to show. Can be used to show specific icons hidden by default without completely customizing the toolbar.
36
36
-**spellChecker**: If set to `false`, disable the spell checker. Defaults to `true`.
@@ -43,79 +43,85 @@
43
43
44
44
```JavaScript
45
45
// Most options demonstrate the non-default behavior
46
-
var simplemde =newSimpleMDE({
47
-
autofocus:true,
48
-
autosave: {
49
-
enabled:true,
50
-
uniqueId:"MyUniqueID",
51
-
delay:1000,
52
-
},
53
-
blockStyles: {
54
-
bold:"__",
55
-
italic:"_"
56
-
},
57
-
element:document.getElementById("MyID"),
58
-
forceSync:true,
59
-
hideIcons: ["guide", "heading"],
60
-
indentWithTabs:false,
61
-
initialValue:"Hello world!",
62
-
insertTexts: {
63
-
horizontalRule: ["", "\n\n-----\n\n"],
64
-
image: [""],
65
-
link: ["[", "](http://)"],
66
-
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
67
-
},
68
-
lineWrapping:false,
69
-
parsingConfig: {
70
-
allowAtxHeaderWithoutSpace:true,
71
-
strikethrough:false,
72
-
underscoresBreakWords:true,
73
-
},
74
-
placeholder:"Type here...",
75
-
previewRender:function(plainText) {
76
-
returncustomMarkdownParser(plainText); // Returns HTML from a custom parser
}], // Another optional usage, with a custom status bar item that counts keystrokes
110
+
styleSelectedText: false,
111
+
tabSize: 4,
112
+
toolbar: false,
113
+
toolbarTips: false
114
+
}
105
115
}
106
-
}], // Another optional usage, with a custom status bar item that counts keystrokes
107
-
styleSelectedText:false,
108
-
tabSize:4,
109
-
toolbar:false,
110
-
toolbarTips:false,
111
-
});
116
+
}
117
+
}
112
118
```
113
119
114
120
#### Toolbar icons
115
121
116
-
Below are the built-in toolbar icons (only some of which are enabled by default), which can be reorganized however you like. "Name" is the name of the icon, referenced in the JS. "Action" is either a function or a URL to open. "Class" is the class given to the icon. "Tooltip" is the small tooltip that appears via the `title=""` attribute. Note that shortcut hints are added automatically and reflect the specified action if it has a keybind assigned to it (i.e. with the value of `action` set to `bold` and that of `tooltip` set to `Bold`, the final text the user will see would be "Bold (Ctrl-B)").
122
+
Below are the built-in toolbar icons (only some of which are enabled by default), which can be reorganized however you like. 'Name' is the name of the icon, referenced in the JS. 'Action' is either a function or a URL to open. 'Class' is the class given to the icon. 'Tooltip' is the small tooltip that appears via the `title='` attribute. Note that shortcut hints are added automatically and reflect the specified action if it has a keybind assigned to it (i.e. with the value of `action` set to `bold` and that of `tooltip` set to `Bold`, the final text the user will see would be 'Bold (Ctrl-B)').
117
123
118
-
Additionally, you can add a separator between any icons by adding `"|"` to the toolbar array.
124
+
Additionally, you can add a separator between any icons by adding `'|'` to the toolbar array.
119
125
120
126
Name | Action | Tooltip<br>Class
121
127
:--- | :----- | :--------------
@@ -146,30 +152,42 @@ Customize the toolbar using the `toolbar` option like:
// Customize all information and/or add your own icons
154
-
var simplemde =newSimpleMDE({
155
-
toolbar: [{
156
-
name:"bold",
157
-
action:SimpleMDE.toggleBold,
158
-
className:"fa fa-bold",
159
-
title:"Bold",
160
-
},
161
-
{
162
-
name:"custom",
163
-
action:functioncustomFunction(editor){
164
-
// Add your own code
165
-
},
166
-
className:"fa fa-star",
167
-
title:"Custom Button",
168
-
},
169
-
"|", // Separator
170
-
...
171
-
],
172
-
});
166
+
exportdefault {
167
+
data () {
168
+
return {
169
+
configs: {
170
+
toolbar: [{
171
+
name:'bold',
172
+
action:SimpleMDE.toggleBold,
173
+
className:'fa fa-bold',
174
+
title:'Bold'
175
+
},
176
+
{
177
+
name:'custom',
178
+
action:functioncustomFunction(editor){
179
+
// Add your own code
180
+
},
181
+
className:'fa fa-star',
182
+
title:'Custom Button'
183
+
},
184
+
'|'// Separator
185
+
...
186
+
]
187
+
}
188
+
}
189
+
}
190
+
}
173
191
```
174
192
175
193
#### Keyboard shortcuts
@@ -178,34 +196,40 @@ SimpleMDE comes with an array of predefined keyboard shortcuts, but they can be
178
196
179
197
Shortcut | Action
180
198
:------- | :-----
181
-
*Cmd-'* | "toggleBlockquote"
182
-
*Cmd-B* | "toggleBold"
183
-
*Cmd-E* | "cleanBlock"
184
-
*Cmd-H* | "toggleHeadingSmaller"
185
-
*Cmd-I* | "toggleItalic"
186
-
*Cmd-K* | "drawLink"
187
-
*Cmd-L* | "toggleUnorderedList"
188
-
*Cmd-P* | "togglePreview"
189
-
*Cmd-Alt-C* | "toggleCodeBlock"
190
-
*Cmd-Alt-I* | "drawImage"
191
-
*Cmd-Alt-L* | "toggleOrderedList"
192
-
*Shift-Cmd-H* | "toggleHeadingBigger"
193
-
*F9* | "toggleSideBySide"
194
-
*F11* | "toggleFullScreen"
199
+
*Cmd-'* | 'toggleBlockquote'
200
+
*Cmd-B* | 'toggleBold'
201
+
*Cmd-E* | 'cleanBlock'
202
+
*Cmd-H* | 'toggleHeadingSmaller'
203
+
*Cmd-I* | 'toggleItalic'
204
+
*Cmd-K* | 'drawLink'
205
+
*Cmd-L* | 'toggleUnorderedList'
206
+
*Cmd-P* | 'togglePreview'
207
+
*Cmd-Alt-C* | 'toggleCodeBlock'
208
+
*Cmd-Alt-I* | 'drawImage'
209
+
*Cmd-Alt-L* | 'toggleOrderedList'
210
+
*Shift-Cmd-H* | 'toggleHeadingBigger'
211
+
*F9* | 'toggleSideBySide'
212
+
*F11* | 'toggleFullScreen'
195
213
196
214
Here is how you can change a few, while leaving others untouched:
197
215
198
216
```JavaScript
199
-
var simplemde =newSimpleMDE({
200
-
shortcuts: {
201
-
"toggleOrderedList":"Ctrl-Alt-K", // alter the shortcut for toggleOrderedList
202
-
"toggleCodeBlock":null, // unbind Ctrl-Alt-C
203
-
"drawTable":"Cmd-Alt-T"// bind Cmd-Alt-T to drawTable action, which doesn't come with a default shortcut
217
+
exportdefault {
218
+
data () {
219
+
return {
220
+
configs: {
221
+
shortcuts: {
222
+
'toggleOrderedList':'Ctrl-Alt-K', // alter the shortcut for toggleOrderedList
223
+
'toggleCodeBlock':null, // unbind Ctrl-Alt-C
224
+
'drawTable':'Cmd-Alt-T'// bind Cmd-Alt-T to drawTable action, which doesn't come with a default shortcut
225
+
}
226
+
}
227
+
}
204
228
}
205
-
});
229
+
}
206
230
```
207
231
208
-
Shortcuts are automatically converted between platforms. If you define a shortcut as "Cmd-B", on PC that shortcut will be changed to "Ctrl-B". Conversely, a shortcut defined as "Ctrl-B" will become "Cmd-B" for Mac users.
232
+
Shortcuts are automatically converted between platforms. If you define a shortcut as 'Cmd-B', on PC that shortcut will be changed to 'Ctrl-B'. Conversely, a shortcut defined as 'Ctrl-B' will become 'Cmd-B' for Mac users.
209
233
210
234
The list of actions that can be bound is the same as the list of built-in actions available for [toolbar buttons](#toolbar-icons).
0 commit comments