@writergate/quill-image-uploader-nextjs 0.1.0 → 0.1.1
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/package.json
CHANGED
@@ -47,14 +47,8 @@ class ImageUploader {
|
|
47
47
|
|
48
48
|
calculateIndexChange(delta) {
|
49
49
|
var index = delta.ops[0].retain || 0;
|
50
|
-
|
51
|
-
|
52
|
-
}).map(function (i) { return i.attributes && i.attributes['code-block'] ? i.insert.replaceAll('\n', '') : i.insert; }).join()
|
53
|
-
var insLength = insert ? insert.length : 0;
|
54
|
-
var delLength = delta.ops.filter(function (i) {
|
55
|
-
return i.delete;
|
56
|
-
}).map(function (i) { return i.delete }).reduce((a, b) => a + b, 0);
|
57
|
-
return { index: index, change: insLength - delLength };
|
50
|
+
const change = delta.changeLength();
|
51
|
+
return { index: index, change: change };
|
58
52
|
}
|
59
53
|
|
60
54
|
adjustIndex(currentIndex, indexDelta) {
|
@@ -62,7 +56,7 @@ class ImageUploader {
|
|
62
56
|
// comment index is before the modified text and modification didn't shift content before its starting point
|
63
57
|
return currentIndex;
|
64
58
|
} else if (indexDelta.change < 0 && currentIndex < (indexDelta.index + indexDelta.change)) {
|
65
|
-
// code shifted before its starting point but
|
59
|
+
// code shifted before its starting point but the comment index is before the modified text
|
66
60
|
return currentIndex;
|
67
61
|
} else {
|
68
62
|
return currentIndex + indexDelta.change;
|