ponkotsu-md-editor 0.1.30 → 0.1.31
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/markdown_editor.js +13 -0
- data/lib/ponkotsu/md/editor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c494ea95998125ae5ffdfb388494d077706a5d3ccc67e971ebc5e9a3e38c78b3
|
|
4
|
+
data.tar.gz: 39ab32a80c24446985b47eb4722a37c2232c52b5d3478995d8a0b1473987d2fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 70778a6c31e9fede61028eb05f356506bdb8bb17a49f32f675e3591c018f96d35113d0bd3e11c83461a50ed095cff89228d14a1bd73e5e9f2a47e250f92a068a
|
|
7
|
+
data.tar.gz: e82a6e80136b094157501002f0b822eab30fd46b58d86647f1a9424834a97e022b7c861d9aedeef47fcd0d0869cd5455c13d0130b77c12b54a760b5da2dff643
|
|
@@ -283,6 +283,19 @@
|
|
|
283
283
|
selectedText = textarea.value.substring(start, end);
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
// Bold(**)の場合のみ、選択範囲の両端に余分な空白・改行があれば除外
|
|
287
|
+
if (before === '**' && after === '**' && selectedText.length > 0) {
|
|
288
|
+
let left = 0;
|
|
289
|
+
let right = selectedText.length;
|
|
290
|
+
while (left < right && /[\s\n]/.test(selectedText[left])) left++;
|
|
291
|
+
while (right > left && /[\s\n]/.test(selectedText[right-1])) right--;
|
|
292
|
+
if (left !== 0 || right !== selectedText.length) {
|
|
293
|
+
start += left;
|
|
294
|
+
end -= (selectedText.length - right);
|
|
295
|
+
selectedText = selectedText.substring(left, right);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
286
299
|
const fullText = isContentEditable ?
|
|
287
300
|
(textarea.innerText || textarea.textContent || '') :
|
|
288
301
|
textarea.value;
|