1.5.1 • Published 1 month ago
textarea-markdown v1.5.1
textarea-markdown
Make textarea a markdown editor.
Usage
$ npm install textarea-markdown
<h2>Editor</h2>
<textarea id="editor" data-preview="#preview"></textarea>
<h2>Preview</h2>
<div id="preview"></div>
import TextareaMarkdown from 'textarea-markdown'
let textarea = document.querySelector('textarea');
new TextareaMarkdown(textarea);
with rails.
<textarea id="editor" data-preview="#preview"></textarea>
<div id="preview"></div>
import TextareaMarkdown from 'textarea-markdown'
document.addEventListener('DOMContentLoaded', () => {
const token = document.querySelector("meta[name=\"csrf-token\"]").content;
const textarea = document.querySelector('#editor');
new TextareaMarkdown(textarea, {
endPoint: '/api/image.json',
paramName: 'file',
responseKey: 'url',
csrfToken: token,
placeholder: 'uploading %filename ...',
uploadImageTag: '<img src=%url width="100" height="100" alt="%filename">\n',
})
});
Options
useUploader
- type: Boolean
- default: true
Enable uploading files on drop when the value is set to true
file upload by file selection dialog
Enable uploading files by file selection dialog when using <input>
as in the following code
<h2>Editor & File input</h2>
<input type="file" class="data-input">
<textarea id="editor" data-preview="#preview" data-input=".input"></textarea>
<h2>Preview</h2>
<div id="preview"></div>
import TextareaMarkdown from 'textarea-markdown'
let textarea = document.querySelector('textarea');
new TextareaMarkdown(textarea);
1.5.1
1 month ago
1.4.0
10 months ago
1.3.10
11 months ago
1.3.11
11 months ago
1.3.12
11 months ago
1.3.7
1 year ago
1.3.6
1 year ago
1.3.5
1 year ago
1.3.4
1 year ago
1.3.3
1 year ago
1.3.2
2 years ago
1.3.1
3 years ago
1.3.0
3 years ago
1.2.11
4 years ago
1.2.10
4 years ago
1.2.8
4 years ago
1.2.9
4 years ago
1.2.7
4 years ago
1.2.6
4 years ago
1.2.5
4 years ago
1.2.4
6 years ago
1.2.3
6 years ago
1.2.2
6 years ago
1.2.1
6 years ago
1.2.0
6 years ago
1.1.0
6 years ago
1.0.0
7 years ago