ponkotsu-md-editor 0.1.31 → 0.1.32
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: 20516b4cf7de7bf33b5db048a4a440ac8610cd6beb8c0f1467e4285aff2f5c01
|
|
4
|
+
data.tar.gz: ffe60497f34d0a334893df718e780dc1185520702050404de42cd58438d7f475
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 71e0526ff22119d58f15996cfc5eaeda4670efc11d2cba467dcfea8a6ec73799aef89e82112ea8e03c1562142dce004bd13fa1707cc945b430e8cadc93645836
|
|
7
|
+
data.tar.gz: dcbd053ab758b2f967f9454542a165f35e919f15ce8918a845011f8bae8ff2a153767fe150d52f7ef3d414dc869ce7b4081a9ea11164fbc1bab6890df81d8a34
|
|
@@ -287,6 +287,19 @@
|
|
|
287
287
|
if (before === '**' && after === '**' && selectedText.length > 0) {
|
|
288
288
|
let left = 0;
|
|
289
289
|
let right = selectedText.length;
|
|
290
|
+
// 先頭が「\n 」ならスペース除去
|
|
291
|
+
if (selectedText.startsWith('\n ')) {
|
|
292
|
+
left += 2;
|
|
293
|
+
} else if (selectedText[0] === ' ' && (start > 0 && fullText[start-1] === '\n')) {
|
|
294
|
+
left += 1;
|
|
295
|
+
}
|
|
296
|
+
// 末尾が「 \n」ならスペース除去
|
|
297
|
+
if (selectedText.endsWith(' \n')) {
|
|
298
|
+
right -= 2;
|
|
299
|
+
} else if (selectedText[selectedText.length-1] === ' ' && (end < fullText.length && fullText[end] === '\n')) {
|
|
300
|
+
right -= 1;
|
|
301
|
+
}
|
|
302
|
+
// 既存の両端trimも併用(ただしスペース・改行のみ)
|
|
290
303
|
while (left < right && /[\s\n]/.test(selectedText[left])) left++;
|
|
291
304
|
while (right > left && /[\s\n]/.test(selectedText[right-1])) right--;
|
|
292
305
|
if (left !== 0 || right !== selectedText.length) {
|