Skip to content

Commit 9988216

Browse files
committed
hotfix
1 parent 8287ed3 commit 9988216

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

src/lib/nbt.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,9 @@ function processTextComponent(text: StringyMCText, baseDocument: JSONContent) {
2828
return;
2929
}
3030

31-
baseDocument.content?.push({
32-
type: "paragraph",
33-
content: [
34-
{
35-
type: "text",
36-
text: text,
37-
},
38-
],
31+
baseDocument.content!.at(-1)!.content!.push({
32+
type: "text",
33+
text: text,
3934
});
4035
baseDocument = baseDocument;
4136
return;
@@ -53,6 +48,8 @@ function processTextComponent(text: StringyMCText, baseDocument: JSONContent) {
5348

5449
paragraphContent!.push(finalText);
5550

51+
console.log(finalText)
52+
5653
// Extra property
5754
if (text.extra) {
5855
text.extra!.forEach((txt) => {

src/lib/tiptap/text.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,12 @@ export function optimise(arr: StringyMCText[], lore = false): StringyMCText[] {
342342
const curr = out[i], next = out[i + 1];
343343

344344
// Merge whitespace to prev component
345-
if (typeof curr === "object" && curr?.text && typeof next === "string" && (next.trim() === "" || next.trim() === "\n")) {
346-
curr.text += next;
347-
out.splice(i + 1, 1); i--;
348-
continue;
349-
}
345+
// todo fix
346+
// if (typeof curr === "object" && curr?.text && typeof next === "string" && (next.trim() === "" || next.trim() === "\n")) {
347+
// curr.text += next;
348+
// out.splice(i + 1, 1); i--;
349+
// continue;
350+
// }
350351
// Merge consecutive strings
351352
if (typeof curr === "string" && typeof next === "string") {
352353
out[i] = curr + next;
@@ -480,7 +481,7 @@ export function convert(
480481
let out = translate(jsonContent, exportType, false, 0, exportVersion)
481482
if (exportVersion == "new") { // only remove strings
482483
out = out.replace(
483-
/"(?:[^"\\]*(?:\\.[^"\\]*)*)"\s*:/g,
484+
/(?<=[{,]\s*)"[^"]*"\s*:/g,
484485
(match) => match.replace(/"/g, ""),
485486
);
486487
}

0 commit comments

Comments
 (0)