Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(md): remove tabindex on checklist li's - firefox fix (#4314)

Seamuse8368bb7c037
diff --git a/js/app/packages/block-md/component/Notebook.tsx b/js/app/packages/block-md/component/Notebook.tsx
index 1ad774b371..1f533a84da 100644
--- a/js/app/packages/block-md/component/Notebook.tsx
+++ b/js/app/packages/block-md/component/Notebook.tsx
@@ -25,6 +25,7 @@ import {
import { tempRedirectLocation } from '@core/signal/location';
import { useBlockDocumentName } from '@core/util/currentBlockDocumentName';
import { makeResizeObserver } from '@solid-primitives/resize-observer';
+import { makePersisted } from '@solid-primitives/storage';
import {
createEffect,
createMemo,
@@ -45,6 +46,16 @@ import {
registerMarkdownCommands,
} from './useMarkdownCommands';
+/**
+ * Whether the Lexical state debugger panel is open, persisted across reloads so
+ * the debug panel stays where the user left it. Shared by every notebook so the
+ * toggle is consistent regardless of which editor surfaced it.
+ */
+const [showLexicalStateDebugger, setShowLexicalStateDebugger] = makePersisted(
+ createSignal(false),
+ { name: 'lexical-state-debugger-open' }
+);
+
const NoteTargetWidth = 768;
const CommentTargetWidth = 320;
const GapTargetWidth = 24;
@@ -95,8 +106,6 @@ export function Notebook(props: { loroManager: LoroManager }) {
const [layoutMode, setLayoutMode] = createSignal(CommentLayoutMode.none);
const [width, setWidth] = createSignal(0);
const [leftFloatX, setLeftFloatX] = createSignal(0);
- const [showLexicalStateDebugger, setShowLexicalStateDebugger] =
- createSignal(false);
const canUseLexicalStateDebugger = useCanUseLexicalStateDebugger();
const comments = commentsStore.get;
@@ -322,8 +331,6 @@ export function Notebook(props: { loroManager: LoroManager }) {
export function InstructionsNotebook(props: { loroManager: LoroManager }) {
const setStore = mdStore.set;
const scopeId = blockHotkeyScopeSignal.get;
- const [showLexicalStateDebugger, setShowLexicalStateDebugger] =
- createSignal(false);
const canUseLexicalStateDebugger = useCanUseLexicalStateDebugger();
let notebookRef!: HTMLDivElement;
diff --git a/js/app/packages/core/component/LexicalMarkdown/plugins/checklist/checklistPlugin.ts b/js/app/packages/core/component/LexicalMarkdown/plugins/checklist/checklistPlugin.ts
index 6319f2eea7..0322f5ae5d 100644
--- a/js/app/packages/core/component/LexicalMarkdown/plugins/checklist/checklistPlugin.ts
+++ b/js/app/packages/core/component/LexicalMarkdown/plugins/checklist/checklistPlugin.ts
@@ -3,7 +3,7 @@ import {
$insertList,
$isListItemNode,
INSERT_CHECK_LIST_COMMAND,
- type ListItemNode,
+ ListItemNode,
} from '@lexical/list';
import { mergeRegister } from '@lexical/utils';
import {
@@ -122,6 +122,27 @@ function registerMouseEvents(editor: LexicalEditor) {
});
}
+function removeChecklistItemTabIndex(editor: LexicalEditor, nodeKey: string) {
+ const element = editor.getElementByKey(nodeKey);
+ if (element?.getAttribute('role') === 'checkbox') {
+ element.removeAttribute('tabindex');
+ }
+}
+
+function registerChecklistTabIndexGuard(editor: LexicalEditor) {
+ return editor.registerMutationListener(
+ ListItemNode,
+ (mutations) => {
+ for (const [nodeKey, mutation] of mutations) {
+ if (mutation !== 'destroyed') {
+ removeChecklistItemTabIndex(editor, nodeKey);
+ }
+ }
+ },
+ { skipInitialization: false }
+ );
+}
+
/**
* Toggle the check boxes in a selection.
*/
@@ -179,6 +200,7 @@ function registerChecklistPlugin(editor: LexicalEditor) {
COMMAND_PRIORITY_LOW
),
registerMouseEvents(editor),
+ registerChecklistTabIndexGuard(editor),
editor.registerCommand(
KEY_ENTER_COMMAND,
(e) => {
diff --git a/js/lexical-core/nodes/AwaitNode.ts b/js/lexical-core/nodes/AwaitNode.ts
index 81f5152ddf..dac90d123a 100644
--- a/js/lexical-core/nodes/AwaitNode.ts
+++ b/js/lexical-core/nodes/AwaitNode.ts
@@ -1,6 +1,7 @@
import {
$applyNodeReplacement,
DecoratorNode,
+ type DOMConversionMap,
type EditorConfig,
type EditorThemeClasses,
type LexicalEditor,
@@ -131,6 +132,10 @@ export class AwaitNode extends DecoratorNode<
return { element: null };
}
+ static importDOM(): DOMConversionMap | null {
+ return null;
+ }
+
getAwaitId(): string {
return this.__awaitId;
}
diff --git a/js/lexical-core/nodes/CompletionNode.ts b/js/lexical-core/nodes/CompletionNode.ts
index 33dc8062a5..0c4b9ead07 100644
--- a/js/lexical-core/nodes/CompletionNode.ts
+++ b/js/lexical-core/nodes/CompletionNode.ts
@@ -1,5 +1,6 @@
import {
$applyNodeReplacement,
+ type DOMConversionMap,
ElementNode,
type LexicalEditor,
type LexicalNode,
@@ -58,6 +59,10 @@ export class CompletionNode extends ElementNode {
return { element: null };
}
+ static importDOM(): DOMConversionMap | null {
+ return null;
+ }
+
excludeFromCopy() {
return true;
}
diff --git a/js/lexical-core/nodes/UnlinkedTextNode.ts b/js/lexical-core/nodes/UnlinkedTextNode.ts
index 5a1e719c48..33fe3d826e 100644
--- a/js/lexical-core/nodes/UnlinkedTextNode.ts
+++ b/js/lexical-core/nodes/UnlinkedTextNode.ts
@@ -7,6 +7,7 @@ import {
$applyNodeReplacement,
$getSelection,
$isRangeSelection,
+ type DOMConversionMap,
type EditorConfig,
type LexicalEditor,
type LexicalNode,
@@ -42,6 +43,10 @@ export class UnlinkedTextNode extends TextNode {
return super.exportDOM(editor);
}
+ static importDOM(): DOMConversionMap | null {
+ return null;
+ }
+
exportJSON(): SerializedUnlinkedTextNode {
return {
...super.exportJSON(),