overtype 2.3.6 → 2.3.7
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 +7 -2
- package/dist/overtype-webcomponent.esm.js +18 -7
- package/dist/overtype-webcomponent.esm.js.map +2 -2
- package/dist/overtype-webcomponent.js +18 -7
- package/dist/overtype-webcomponent.js.map +2 -2
- package/dist/overtype-webcomponent.min.js +40 -40
- package/dist/overtype.cjs +18 -7
- package/dist/overtype.cjs.map +2 -2
- package/dist/overtype.esm.js +18 -7
- package/dist/overtype.esm.js.map +2 -2
- package/dist/overtype.js +18 -7
- package/dist/overtype.js.map +2 -2
- package/dist/overtype.min.js +41 -41
- package/package.json +1 -1
- package/src/overtype.js +16 -6
- package/src/parser.js +3 -3
package/dist/overtype.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OverType v2.3.
|
|
2
|
+
* OverType v2.3.7
|
|
3
3
|
* A lightweight markdown editor library with perfect WYSIWYG alignment
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @author David Miranda
|
|
@@ -148,13 +148,13 @@ var MarkdownParser = class {
|
|
|
148
148
|
* @returns {string} Parsed task list item
|
|
149
149
|
*/
|
|
150
150
|
static parseTaskList(html, isPreviewMode = false) {
|
|
151
|
-
return html.replace(/^((?: )*)
|
|
151
|
+
return html.replace(/^((?: )*)-(\s+)\[([ xX])\](\s*)(.*)$/, (match, indent, spacingBeforeBox, checked, spacingAfterBox, content) => {
|
|
152
152
|
content = this.parseInlineElements(content);
|
|
153
153
|
if (isPreviewMode) {
|
|
154
154
|
const isChecked = checked.toLowerCase() === "x";
|
|
155
155
|
return `${indent}<li class="task-list"><input type="checkbox" ${isChecked ? "checked" : ""}> ${content}</li>`;
|
|
156
156
|
} else {
|
|
157
|
-
return `${indent}<li class="task-list"><span class="syntax-marker"
|
|
157
|
+
return `${indent}<li class="task-list"><span class="syntax-marker">-${spacingBeforeBox}[${checked}]${spacingAfterBox}</span>${content}</li>`;
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
160
|
}
|
|
@@ -4741,7 +4741,7 @@ var _OverType = class _OverType {
|
|
|
4741
4741
|
});
|
|
4742
4742
|
this.initialized = true;
|
|
4743
4743
|
if (this.options.onChange) {
|
|
4744
|
-
this.
|
|
4744
|
+
this._notifyChange();
|
|
4745
4745
|
}
|
|
4746
4746
|
}
|
|
4747
4747
|
/**
|
|
@@ -5181,13 +5181,19 @@ var _OverType = class _OverType {
|
|
|
5181
5181
|
if (this.options.showStats && this.statsBar) {
|
|
5182
5182
|
this._updateStats();
|
|
5183
5183
|
}
|
|
5184
|
-
if (this.options.onChange && this.initialized) {
|
|
5185
|
-
this.options.onChange(text, this);
|
|
5186
|
-
}
|
|
5187
5184
|
if (this.options.onRender) {
|
|
5188
5185
|
this.options.onRender(this.preview, isPreviewMode ? "preview" : "normal", this);
|
|
5189
5186
|
}
|
|
5190
5187
|
}
|
|
5188
|
+
/**
|
|
5189
|
+
* Notify listeners that the editor value changed
|
|
5190
|
+
* @private
|
|
5191
|
+
*/
|
|
5192
|
+
_notifyChange() {
|
|
5193
|
+
if (!this.options.onChange || !this.initialized)
|
|
5194
|
+
return;
|
|
5195
|
+
this.options.onChange(this.textarea.value, this);
|
|
5196
|
+
}
|
|
5191
5197
|
/**
|
|
5192
5198
|
* Apply background styling to code blocks
|
|
5193
5199
|
* @private
|
|
@@ -5221,6 +5227,7 @@ var _OverType = class _OverType {
|
|
|
5221
5227
|
*/
|
|
5222
5228
|
handleInput(event) {
|
|
5223
5229
|
this.updatePreview();
|
|
5230
|
+
this._notifyChange();
|
|
5224
5231
|
}
|
|
5225
5232
|
/**
|
|
5226
5233
|
* Handle keydown events
|
|
@@ -5401,11 +5408,15 @@ var _OverType = class _OverType {
|
|
|
5401
5408
|
* @param {string} value - Markdown content to set
|
|
5402
5409
|
*/
|
|
5403
5410
|
setValue(value) {
|
|
5411
|
+
const didChange = this.textarea.value !== value;
|
|
5404
5412
|
this.textarea.value = value;
|
|
5405
5413
|
this.updatePreview();
|
|
5406
5414
|
if (this.options.autoResize) {
|
|
5407
5415
|
this._updateAutoHeight();
|
|
5408
5416
|
}
|
|
5417
|
+
if (didChange) {
|
|
5418
|
+
this._notifyChange();
|
|
5419
|
+
}
|
|
5409
5420
|
}
|
|
5410
5421
|
/**
|
|
5411
5422
|
* Execute an action by ID
|