MCPcopy
hub / github.com/udecode/plate / syncLegacyMethods

Function syncLegacyMethods

packages/slate/src/utils/assignLegacyTransforms.ts:185–206  ·  view source on GitHub ↗
(editor: Editor)

Source from the content-addressed store, hash-verified

183 * NOTE: can't use yet because of recursion issues
184 */
185export const syncLegacyMethods = (editor: Editor) => {
186 const e = editor as Editor & LegacyEditorMethods & UnknownObject;
187
188 // Assign to editor.api
189 LEGACY_API.forEach((key) => {
190 if (e[key]) {
191 if (key === 'getMarks') {
192 // Special case for marks
193 (e.api as any).marks = e.getMarks;
194 } else {
195 (e.api as any)[key] = e[key];
196 }
197 }
198 });
199
200 // Assign to editor.tf
201 LEGACY_TRANSFORMS.forEach((key) => {
202 if (e[key]) {
203 (e.tf as any)[key] = e[key];
204 }
205 });
206};

Callers 10

resolvePluginsFunction · 0.90
createEditorFunction · 0.90
withInlineVoidFunction · 0.90
withInlineVoidFunction · 0.90
withReadOnlyInlineFunction · 0.90
withMarkableVoidFunction · 0.90
withHistoryFunction · 0.90

Calls

no outgoing calls

Tested by 4

withInlineVoidFunction · 0.72
withInlineVoidFunction · 0.72
withReadOnlyInlineFunction · 0.72
withMarkableVoidFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…