Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,11 @@

const dispatch = createEventDispatcher();

// Internal reactive state - sync with content prop changes
// Internal reactive state - initialized from content prop
// Note: Content updates flow through handleContentChange event, not prop sync
// External changes are rare (only from parent re-renders) and handled by component remount
let internalContent = $state(content);

// Sync internalContent when content prop changes externally
$effect(() => {
internalContent = content;
});

// Parse language from opening fence (```language or just ```)
let language = $state<string>(parseLanguage(content));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,14 @@
const NEWLINE_LENGTH = 1; // \n character
const LIST_PREFIX_LENGTH = 3; // "1. " prefix length

// Internal reactive state - sync with content prop changes
// Internal reactive state - initialized from content prop
// Note: Content updates flow through handleContentChange event, not prop sync
// External changes are rare (only from parent re-renders) and handled by component remount
let internalContent = $state(content);

// Track if we just added prefixes (for cursor adjustment)
let pendingCursorAdjustment = $state<number | null>(null);

// Sync internalContent when content prop changes externally
$effect(() => {
internalContent = content;
});

// Ordered lists use multiline editing (Shift+Enter for new lines with auto "1. " prefix)
// Prevent merging into ordered-lists (structured content can't accept arbitrary merges)
const editableConfig = { allowMultiline: true, allowMergeInto: false };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,14 @@
const NEWLINE_LENGTH = 1; // \n character
const QUOTE_PREFIX_LENGTH = 2; // "> " prefix

// Internal reactive state - sync with content prop changes
// Internal reactive state - initialized from content prop
// Note: Content updates flow through handleContentChange event, not prop sync
// External changes are rare (only from parent re-renders) and handled by component remount
let internalContent = $state(content);

// Track if we just added prefixes (for cursor adjustment)
let pendingCursorAdjustment = $state<number | null>(null);

// Sync internalContent when content prop changes externally
$effect(() => {
internalContent = content;
});

// Quote blocks use multiline editing (Shift+Enter for new lines with auto > prefix)
// Prevent merging into quote-blocks (structured content can't accept arbitrary merges)
const editableConfig = { allowMultiline: true, allowMergeInto: false };
Expand Down