markdown-text-editor 0.0.21-beta.3 → 0.0.24-beta.3
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 +60 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,10 @@ Welcome to the documentation for the **MarkdownEditor Plugin** – an **open sou
|
|
|
9
9
|
- [Overview](#overview)
|
|
10
10
|
- [Installation](#installation)
|
|
11
11
|
- [Usage](#usage)
|
|
12
|
+
- [Markdown Content Retrieval](#markdown-content-retrieval)
|
|
12
13
|
- [Configuration Options](#configuration-options)
|
|
14
|
+
- [JavaScript Value Retrieval](#javascript-value-retrieval)
|
|
15
|
+
- [HTML Template Form Submission](#html-template-form-submission)
|
|
13
16
|
- [Toolbar Customization](#toolbar-customization)
|
|
14
17
|
- [Example Implementations](#example-implementations)
|
|
15
18
|
- [Contribution Guidelines](#contribute)
|
|
@@ -115,6 +118,63 @@ Alternatively, include the following CDN links in your HTML:
|
|
|
115
118
|
|
|
116
119
|
---
|
|
117
120
|
|
|
121
|
+
## Markdown Content Retrieval
|
|
122
|
+
|
|
123
|
+
### JavaScript Value Retrieval
|
|
124
|
+
|
|
125
|
+
In this method, you can access the markdown content entered into the editor directly using JavaScript. This is helpful when you want to dynamically retrieve the value and process it in your application (e.g., displaying it elsewhere or sending it via AJAX).
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
#### HTML
|
|
129
|
+
|
|
130
|
+
```html
|
|
131
|
+
<form>
|
|
132
|
+
<textarea class="editor-container"></textarea>
|
|
133
|
+
<button type="button" id="submit-btn">Submit</button>
|
|
134
|
+
<div class="output"></div>
|
|
135
|
+
</form>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### JavaScript
|
|
139
|
+
|
|
140
|
+
```javascript
|
|
141
|
+
const editor = new MarkdownEditor('.editor-container', {
|
|
142
|
+
placeholder: 'Start writing...',
|
|
143
|
+
toolbar: ['bold', 'italic', 'preview'],
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
document.getElementById('submit-btn').addEventListener('click', function() {
|
|
147
|
+
const markdownValue = document.querySelector('.editor-container').value;
|
|
148
|
+
console.log(markdownValue);
|
|
149
|
+
document.querySelector('.output').innerHTML = `<pre>${markdownValue}</pre>`;
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### HTML Template Form Submission
|
|
154
|
+
|
|
155
|
+
If you prefer a traditional form submission approach (for example, in server-side applications like Django), you can integrate the markdown editor into a form that submits the value to the server for processing.
|
|
156
|
+
|
|
157
|
+
#### HTML (Form Submission)
|
|
158
|
+
|
|
159
|
+
```html
|
|
160
|
+
<form method="POST" action="/your-server-endpoint">
|
|
161
|
+
<textarea class="editor-container" name="markdown"></textarea>
|
|
162
|
+
<button type="submit">Submit</button>
|
|
163
|
+
</form>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
you can retrieve the value from a traditional `<textarea>` in a form submission without any custom element. When the form is submitted, the content inside the `<textarea>` is automatically included as part of the form data, using the name attribute of the `<textarea>`.
|
|
167
|
+
|
|
168
|
+
#### JavaScript (MarkdownEditor Initialization)
|
|
169
|
+
|
|
170
|
+
```javascript
|
|
171
|
+
const editor = new MarkdownEditor('.editor-container', {
|
|
172
|
+
placeholder: 'Write your markdown...',
|
|
173
|
+
toolbar: ['preview', 'bold', 'italic'],
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
|
|
118
178
|
## Configuration Options
|
|
119
179
|
|
|
120
180
|
Customize your Markdown editor by passing an `options` object during initialization. Below are some key configuration options:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdown-text-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24-beta.3",
|
|
4
4
|
"description": "A powerful, easy-to-use Markdown editor with a real-time preview, syntax highlighting. Ideal for developers, writers, and content creators who need a seamless, interactive writing experience with full Markdown support.",
|
|
5
5
|
"main": "./dist/markdown-text-editor.js",
|
|
6
6
|
"browser": "dist/markdown-text-editor.js",
|