File tree Expand file tree Collapse file tree
apps/docs/snippets/extensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,34 @@ import { SuperDocEditor } from '/snippets/components/superdoc-editor.jsx'
6767 }
6868 },
6969 ],
70+ [
71+ {
72+ label: ' Toggle inline lock' ,
73+ onClick : (superdoc ) => {
74+ const editor = superdoc ?.activeEditor || superdoc ?.editor
75+ if (! editor ?.commands ) return
76+ const tags = editor .helpers .structuredContentCommands .getStructuredContentTags (editor .state )
77+ const field = tags .find (t => String (t .id ) === ' 1' )
78+ const locked = field ?.lockMode && field .lockMode !== ' unlocked'
79+ editor .commands .updateStructuredContentById (' 1' , {
80+ attrs: { lockMode: locked ? ' unlocked' : ' sdtContentLocked' },
81+ });
82+ }
83+ },
84+ {
85+ label: ' Toggle block lock' ,
86+ onClick : (superdoc ) => {
87+ const editor = superdoc ?.activeEditor || superdoc ?.editor
88+ if (! editor ?.commands ) return
89+ const tags = editor .helpers .structuredContentCommands .getStructuredContentTags (editor .state )
90+ const field = tags .find (t => String (t .id ) === ' 2' )
91+ const locked = field ?.lockMode && field .lockMode !== ' unlocked'
92+ editor .commands .updateStructuredContentById (' 2' , {
93+ attrs: { lockMode: locked ? ' unlocked' : ' sdtContentLocked' },
94+ });
95+ }
96+ },
97+ ],
7098 [
7199 {
72100 label: ' Delete all fields' ,
You can’t perform that action at this time.
0 commit comments