Skip to content

Uncaught (in promise) Error: nodebuffer is not supported by this platform #63

@abin-zh

Description

@abin-zh

I'm using it in Vue3 + Tiptap
I wrote a code like #4,but get Uncaught (in promise) Error: nodebuffer is not supported by this platform

Image
const exportDocx = async () => {
  if (!editor.value) return

  const nodeSerializer = {
    ...defaultNodes,
    hardBreak: defaultNodes.hard_break,
    codeBlock: defaultNodes.code_block,
    orderedList: defaultNodes.ordered_list,
    listItem: defaultNodes.list_item,
    bulletList: defaultNodes.bullet_list,
    horizontalRule: defaultNodes.horizontal_rule,
  };

  const myDocxSerializer = new DocxSerializer(nodeSerializer, defaultMarks);

  const opts = {
    getImageBuffer(src: string) {
      return new Uint8Array([1, 2, 3]);
    },
  };

  const wordDocument = myDocxSerializer.serialize(editor.value.state.doc, opts);

  writeDocx(wordDocument, (buffer) => {
    // use buffer
  });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions