ponkotsu-md-editor 0.1.40 → 0.1.41
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 +10 -1
- 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: 6b3bd7d2ceb35ca37646c9f4991d81f239ac69a72cb5c0df9de2d0d33329405c
|
|
4
|
+
data.tar.gz: 9546f35e09c7e7229fae0087d7e7d817aff6cdae76a76e6ac272fba2fbcb0c2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9244b36049b0d62ad1e1f8a2da6dbe74bd535176211a734ddf50039ec6525e0375b028474b283650fd74835eb8fff6280ce17d3ed9a2b2148a528078bfbf8df1
|
|
7
|
+
data.tar.gz: 999ab7744606744c0a9f1cb55d1a04b538e608611f026341f8b3fb487aebf792d79b6fb924e1a286f7f454477f39d554f5cfcbefe3a354ae721f651ec48b6de2
|
|
@@ -1460,7 +1460,16 @@
|
|
|
1460
1460
|
|
|
1461
1461
|
// 3. テキスト上書き
|
|
1462
1462
|
window.testReplaceTextAtRange = function(fullText, start, end, decoratedText, selectedText) {
|
|
1463
|
-
//
|
|
1463
|
+
// 通常はstart~endで置換
|
|
1464
|
+
if (fullText.slice(start, end) === selectedText) {
|
|
1465
|
+
return fullText.slice(0, start) + decoratedText + fullText.slice(end);
|
|
1466
|
+
}
|
|
1467
|
+
// 一致しない場合は、fullText内でselectedTextの最初の出現位置を検索して置換
|
|
1468
|
+
const idx = fullText.indexOf(selectedText, start);
|
|
1469
|
+
if (idx !== -1) {
|
|
1470
|
+
return fullText.slice(0, idx) + decoratedText + fullText.slice(idx + selectedText.length);
|
|
1471
|
+
}
|
|
1472
|
+
// それでも見つからない場合は、start~endで強制置換
|
|
1464
1473
|
return fullText.slice(0, start) + decoratedText + fullText.slice(end);
|
|
1465
1474
|
};
|
|
1466
1475
|
|