Skip to content

Commit 5f3a67d

Browse files
committed
Merge pull request sparksuite#189 from NextStepWebs/development
Autosave improvements, Build improvements, New icons, New options, Clearer README
2 parents e05962d + 7a2e75e commit 5f3a67d

File tree

12 files changed

+648
-326
lines changed

12 files changed

+648
-326
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
language: node_js
22
node_js:
3+
- '5'
4+
- '4'
35
- '0.12'
46
before_script:
57
- npm install -g gulp

README.md

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,24 @@ simplemde.value("This text will appear in the editor");
6767

6868
## Configuration
6969

70-
- **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.
70+
- **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.
7171
- **autofocus**: If set to `true`, autofocuses the editor. Defaults to `false`.
7272
- **autosave**: *Saves the text that's being written and will load it back in the future. It will forget the text when the form it's contained in is submitted.*
7373
- **enabled**: If set to `true`, autosave the text. Defaults to `false`.
7474
- **delay**: Delay between saves, in milliseconds. Defaults to `10000` (10s).
75-
- **unique_id**: You must set a unique string identifier so that SimpleMDE can autosave. Something that separates this from other instances of SimpleMDE elsewhere on your website.
75+
- **uniqueId**: You must set a unique string identifier so that SimpleMDE can autosave. Something that separates this from other instances of SimpleMDE elsewhere on your website.
76+
- **blockStyles**: Customize how certain buttons that style blocks of text behave.
77+
- **bold** Can be set to `**` or `__`. Defaults to `**`.
78+
- **italic** Can be set to `*` or `_`. Defaults to `*`.
7679
- **element**: The DOM element for the textarea to use. Defaults to the first textarea on the page.
77-
- **hideIcons**: An array of icon names to hide. Can be used to hide specific icons without completely customizing the toolbar.
80+
- **hideIcons**: An array of icon names to hide. Can be used to hide specific icons shown by default without completely customizing the toolbar.
7881
- **indentWithTabs**: If set to `false`, indent using spaces instead of tabs. Defaults to `true`.
7982
- **initialValue**: If set, will customize the initial value of the editor.
8083
- **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://)"]`.
8184
- horizontalRule
8285
- image
8386
- link
87+
- table
8488
- **lineWrapping**: If set to `false`, disable line wrapping. Defaults to `true`.
8589
- **parsingConfig**: Adjust settings for parsing the Markdown during editing (not previewing).
8690
- **allowAtxHeaderWithoutSpace**: If set to `true`, will render headers without a space after the `#`. Defaults to `false`.
@@ -90,6 +94,7 @@ simplemde.value("This text will appear in the editor");
9094
- **renderingConfig**: Adjust settings for parsing the Markdown during previewing (not editing).
9195
- **singleLineBreaks**: If set to `false`, disable parsing GFM single line breaks. Defaults to `true`.
9296
- **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">`
97+
- **showIcons**: An array of icon names to show. Can be used to show specific icons hidden by default without completely customizing the toolbar.
9398
- **spellChecker**: If set to `false`, disable the spell checker. Defaults to `true`.
9499
- **status**: If set to `false`, hide the status bar. Defaults to `true`.
95100
- Optionally, you can set an array of status bar elements to include, and in what order.
@@ -103,9 +108,13 @@ var simplemde = new SimpleMDE({
103108
autofocus: true,
104109
autosave: {
105110
enabled: true,
106-
unique_id: "MyUniqueID",
111+
uniqueId: "MyUniqueID",
107112
delay: 1000,
108113
},
114+
blockStyles: {
115+
bold: "__",
116+
italic: "_"
117+
},
109118
element: document.getElementById("MyID"),
110119
hideIcons: ["guide", "heading"],
111120
indentWithTabs: false,
@@ -114,6 +123,7 @@ var simplemde = new SimpleMDE({
114123
horizontalRule: ["", "\n\n-----\n\n"],
115124
image: ["![](http://", ")"],
116125
link: ["[", "](http://)"],
126+
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
117127
},
118128
lineWrapping: false,
119129
parsingConfig: {
@@ -135,6 +145,7 @@ var simplemde = new SimpleMDE({
135145
singleLineBreaks: false,
136146
codeSyntaxHighlighting: true,
137147
},
148+
showIcons: ["code", "table"],
138149
spellChecker: false,
139150
status: false,
140151
status: ["autosave", "lines", "words", "cursor"], // Optional usage
@@ -165,6 +176,7 @@ unordered-list | toggleUnorderedList | Generic List (Ctrl+L)<br>fa fa-list-ul
165176
ordered-list | toggleOrderedList | Numbered List (Ctrl+Alt+L)<br>fa fa-list-ol
166177
link | drawLink | Create Link (Ctrl+K)<br>fa fa-link
167178
image | drawImage | Insert Image (Ctrl+Alt+I)<br>fa fa-picture-o
179+
table | drawTable | Insert Table<br>fa fa-table
168180
horizontal-rule | drawHorizontalRule | Insert Horizontal Line<br>fa fa-minus
169181
preview | togglePreview | Toggle Preview (Ctrl+P)<br>fa fa-eye no-disable
170182
side-by-side | toggleSideBySide | Toggle Side by Side (F9)<br>fa fa-columns no-disable no-mobile
@@ -187,6 +199,14 @@ var simplemde = new SimpleMDE({
187199
className: "fa fa-bold",
188200
title: "Bold (Ctrl+B)",
189201
},
202+
{
203+
name: "custom",
204+
action: customFunction(editor){
205+
// Add your own code
206+
},
207+
className: "fa fa-star",
208+
title: "Custom Button",
209+
},
190210
"|", // Separator
191211
...
192212
],
@@ -221,14 +241,15 @@ simplemde.codemirror.on("change", function(){
221241
});
222242
```
223243

224-
## State methods
225-
The following methods will let you check on the state of the editor.
244+
## Useful methods
245+
The following self-explanatory methods may be of use while developing with SimpleMDE.
226246

227247
```js
228248
var simplemde = new SimpleMDE();
229-
simplemde.isPreviewActive();
230-
simplemde.isSideBySideActive();
231-
simplemde.isFullscreenActive();
249+
simplemde.isPreviewActive(); // returns boolean
250+
simplemde.isSideBySideActive(); // returns boolean
251+
simplemde.isFullscreenActive(); // returns boolean
252+
simplemde.clearAutosavedValue(); // no returned value
232253
```
233254

234255
## How it works

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simplemde",
3-
"version": "1.8.1",
3+
"version": "1.9.0",
44
"homepage": "https://github.com/NextStepWebs/simplemde-markdown-editor",
55
"authors": [
66
"Wes Cossick"

debug/simplemde.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* simplemde v1.8.1
2+
* simplemde v1.9.0
33
* Copyright Next Step Webs, Inc.
44
* @link https://github.com/NextStepWebs/simplemde-markdown-editor
55
* @license MIT
@@ -559,7 +559,7 @@ span.CodeMirror-selectedtext { background: none; }
559559
top: 0;
560560
left: 0;
561561
background: #fafafa;
562-
z-index: 2;
562+
z-index: 7;
563563
overflow: auto;
564564
display: none;
565565
box-sizing: border-box;
@@ -573,7 +573,7 @@ span.CodeMirror-selectedtext { background: none; }
573573
top: 50px;
574574
right: 0;
575575
background: #fafafa;
576-
z-index: 9999;
576+
z-index: 9;
577577
overflow: auto;
578578
display: none;
579579
box-sizing: border-box;

0 commit comments

Comments
 (0)