MCPcopy Index your code
hub / github.com/editablejs/editable / withEditor

Function withEditor

packages/serializer/src/text.ts:39–51  ·  view source on GitHub ↗
(
    editor: Editor,
    transform: TextSerializerWithTransform<T>,
    options: T,
  )

Source from the content-addressed store, hash-verified

37 },
38
39 withEditor<T = TextSerializerOptions>(
40 editor: Editor,
41 transform: TextSerializerWithTransform<T>,
42 options: T,
43 ) {
44 const fns = TEXT_SERIALIZER_TRANSFORMS.get(editor) ?? []
45 if (fns.find(fn => fn.transform === transform)) return
46 fns.push({
47 transform: transform as TextSerializerWithTransform,
48 options: options as TextSerializerOptions,
49 })
50 TEXT_SERIALIZER_TRANSFORMS.set(editor, fns)
51 },
52
53 transformWithEditor(editor: Editor, node: Node = editor): string {
54 const TextSerializerEditor = Object.assign({}, TextSerializer)

Calls 1

getMethod · 0.80

Tested by

no test coverage detected