This commit is contained in:
Aitor Moreno 2025-08-11 13:11:50 +02:00
parent 0c3cc20522
commit 6ddaca3e32
4 changed files with 15 additions and 13 deletions

View File

@ -141,6 +141,7 @@
heap (mem/get-heap-u8)] heap (mem/get-heap-u8)]
(.set heap (js/Uint8Array. buffer) metadata-offset))) (.set heap (js/Uint8Array. buffer) metadata-offset)))
(prn "set_shape_text_content")
(h/call wasm/internal-module "_set_shape_text_content")) (h/call wasm/internal-module "_set_shape_text_content"))
(def ^:private emoji-pattern #"[\uD83C-\uDBFF][\uDC00-\uDFFF]|[\u2600-\u27BF]") (def ^:private emoji-pattern #"[\uD83C-\uDBFF][\uDC00-\uDFFF]|[\u2600-\u27BF]")

View File

@ -1382,13 +1382,10 @@ export class SelectionController extends EventTarget {
*/ */
insertParagraph() { insertParagraph() {
if (this.isParagraphEnd) { if (this.isParagraphEnd) {
console.log('a')
return this.insertParagraphAfter(); return this.insertParagraphAfter();
} else if (this.isParagraphStart) { } else if (this.isParagraphStart) {
console.log('b')
return this.insertParagraphBefore(); return this.insertParagraphBefore();
} }
console.log('c')
return this.splitParagraph(); return this.splitParagraph();
} }
@ -1402,16 +1399,18 @@ export class SelectionController extends EventTarget {
this.removeSelected(); this.removeSelected();
const newParagraph = splitParagraph( if (currentParagraph && currentInline) {
currentParagraph, const newParagraph = splitParagraph(
currentInline, currentParagraph,
this.focusOffset, currentInline,
); this.focusOffset,
currentParagraph.after(newParagraph); );
currentParagraph.after(newParagraph);
this.#mutations.update(currentParagraph); this.#mutations.update(currentParagraph);
this.#mutations.add(newParagraph); this.#mutations.add(newParagraph);
} else {
console.log(this.#focusNode)
}
// FIXME: Missing collapse? // FIXME: Missing collapse?
} }

View File

@ -53,6 +53,7 @@ pub fn render(
continue; continue;
} }
// Performs the text layout.
skia_paragraph.layout(shape.bounds().width()); skia_paragraph.layout(shape.bounds().width());
let paragraph_height = skia_paragraph.height(); let paragraph_height = skia_paragraph.height();

View File

@ -11,6 +11,7 @@ pub extern "C" fn clear_shape_text() {
}); });
} }
// TODO: We should modify text content in a smarter way.
#[no_mangle] #[no_mangle]
pub extern "C" fn set_shape_text_content() { pub extern "C" fn set_shape_text_content() {
let bytes = mem::bytes(); let bytes = mem::bytes();