@reiwuzen/blocky 1.4.1 → 1.4.3
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/dist/index.cjs +7 -5
- package/dist/index.js +7 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -566,12 +566,14 @@ function stripPrefix(block, prefix) {
|
|
|
566
566
|
return [{ ...first, text: stripped }, ...block.content.slice(1)];
|
|
567
567
|
}
|
|
568
568
|
function applyMarkdownTransform(block, cursorOffset) {
|
|
569
|
-
if (block.type !== "paragraph")
|
|
569
|
+
if (block.type !== "paragraph")
|
|
570
|
+
return import_result4.Result.Ok({ block, converted: false });
|
|
570
571
|
const text = getRawText(block);
|
|
571
|
-
const match = Object.keys(TRIGGERS).sort((a, b) => b.length - a.length).find((trigger) => text === trigger
|
|
572
|
-
if (!match)
|
|
573
|
-
|
|
574
|
-
if (cursorOffset <
|
|
572
|
+
const match = Object.keys(TRIGGERS).sort((a, b) => b.length - a.length).find((trigger) => text === trigger);
|
|
573
|
+
if (!match)
|
|
574
|
+
return import_result4.Result.Ok({ block, converted: false });
|
|
575
|
+
if (cursorOffset < match.length)
|
|
576
|
+
return import_result4.Result.Ok({ block, converted: false });
|
|
575
577
|
const targetType = TRIGGERS[match];
|
|
576
578
|
const strippedContent = stripPrefix(block, match);
|
|
577
579
|
const converted = {
|
package/dist/index.js
CHANGED
|
@@ -498,12 +498,14 @@ function stripPrefix(block, prefix) {
|
|
|
498
498
|
return [{ ...first, text: stripped }, ...block.content.slice(1)];
|
|
499
499
|
}
|
|
500
500
|
function applyMarkdownTransform(block, cursorOffset) {
|
|
501
|
-
if (block.type !== "paragraph")
|
|
501
|
+
if (block.type !== "paragraph")
|
|
502
|
+
return Result4.Ok({ block, converted: false });
|
|
502
503
|
const text = getRawText(block);
|
|
503
|
-
const match = Object.keys(TRIGGERS).sort((a, b) => b.length - a.length).find((trigger) => text === trigger
|
|
504
|
-
if (!match)
|
|
505
|
-
|
|
506
|
-
if (cursorOffset <
|
|
504
|
+
const match = Object.keys(TRIGGERS).sort((a, b) => b.length - a.length).find((trigger) => text === trigger);
|
|
505
|
+
if (!match)
|
|
506
|
+
return Result4.Ok({ block, converted: false });
|
|
507
|
+
if (cursorOffset < match.length)
|
|
508
|
+
return Result4.Ok({ block, converted: false });
|
|
507
509
|
const targetType = TRIGGERS[match];
|
|
508
510
|
const strippedContent = stripPrefix(block, match);
|
|
509
511
|
const converted = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reiwuzen/blocky",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "Pure TypeScript block editor engine. Headless, framework-agnostic — content mutation, formatting, transforms, serialization, and history.",
|
|
5
5
|
"author": "Rei WuZen",
|
|
6
6
|
"license": "ISC",
|