npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@type-editor/adapter-vue

v0.0.3

Published

Type editor Vue adapter

Readme

@type-editor/adapter-vue

Vue 3 adapter for integrating custom Vue components as ProseMirror node views, mark views, plugin views, and widget decorations.

Overview

@type-editor/adapter-vue bridges ProseMirror's view layer and Vue 3's rendering pipeline. Each ProseMirror node, mark, plugin view, or widget decoration can be backed by an ordinary Vue component. Reactive state is passed to components via Vue's provide/inject mechanism using ShallowRefs; rendering happens via Vue Teleport.

Installation

npm install @type-editor/adapter-vue
# or
pnpm add @type-editor/adapter-vue

Peer dependencies: vue ^3.0.0

Setup

Wrap the component that contains your editor with ProsemirrorAdapterProvider. This component sets up the rendering infrastructure and makes the factory composables available to all descendants via Vue's inject.

<!-- App.vue -->
<script setup lang="ts">
    import { ProsemirrorAdapterProvider } from '@type-editor/adapter-vue';
    import Editor from './Editor.vue';
</script>

<template>
    <ProsemirrorAdapterProvider>
        <Editor />
    </ProsemirrorAdapterProvider>
</template>

Usage

As this is a fork of @prosemirror-adapter/vue, you'll find more documentation and examples in the original repository: https://github.com/prosekit/prosemirror-adapter/tree/main/packages/vue

Node views

1. Create a Vue component

Access the current node and editor state through useNodeViewContext. Reactive properties are exposed as ShallowRefs so Vue's reactivity system picks up changes automatically:

<!-- Paragraph.vue -->
<script setup lang="ts">
    import { useNodeViewContext } from '@type-editor/adapter-vue';
    import { watchEffect } from 'vue';

    const { dom, node } = useNodeViewContext();

    watchEffect(() => {
        if (!dom) return;
        if (node.value?.attrs?.align) {
            dom.style.textAlign = node.value.attrs.align as string;
        }
    });
</script>

<!-- No template output when contentAs: 'self' – ProseMirror manages the content. -->
<template></template>

When you need a content-editable region inside your component, bind contentRef to the wrapper element:


<script setup lang="ts">
    import { useNodeViewContext } from '@type-editor/adapter-vue';

    const { contentRef } = useNodeViewContext();
</script>

<template>
    <div :ref="contentRef" />
</template>

2. Create a node view factory

Use useNodeViewFactory inside a component that is a descendant of ProsemirrorAdapterProvider:

<!-- Editor.vue -->
<script setup lang="ts">
    import { useNodeViewFactory } from '@type-editor/adapter-vue';
    import { PmNode } from '@type-editor/model';
    import Paragraph from './Paragraph.vue';

    const nodeViewFactory = useNodeViewFactory();

    const paragraphView = nodeViewFactory({
        component: Paragraph,
        as: (node: PmNode): HTMLElement => {
            const p = document.createElement('p');
            if (node.attrs.align) p.style.textAlign = node.attrs.align;
            return p;
        },
        contentAs: 'self',
    });

    // Pass to ProseMirror's EditorView
    const editorView = new EditorView(container, {
        state,
        nodeViews: { paragraph: paragraphView },
    });
</script>

Mark views

<!-- BoldMark.vue -->
<script setup lang="ts">
    import { useMarkViewContext } from '@type-editor/adapter-vue';

    const { contentRef } = useMarkViewContext();
</script>
<template><strong :ref="contentRef" /></template>
// In your editor component:
const markViewFactory = useMarkViewFactory();
const boldView = markViewFactory({ component: BoldMark });

Plugin views

<!-- Toolbar.vue -->
<script setup lang="ts">
    import { usePluginViewContext } from '@type-editor/adapter-vue';

    const { view } = usePluginViewContext();
</script>
<template>
    <div class="toolbar">…</div>
</template>
// In your editor component:
const pluginViewFactory = usePluginViewFactory();
const toolbarPlugin = new Plugin({
    view: pluginViewFactory({ component: Toolbar }),
});

Widget views

// In your editor component:
const widgetViewFactory = useWidgetViewFactory();
const decoration = widgetViewFactory(pos, { component: MyWidget });

API reference

ProsemirrorAdapterProvider

Vue component. Must wrap any component that uses the factory composables.

Composables

| Composable | Returns | Description | |--------------------------|---------------------|-----------------------------------------------------------------------| | useNodeViewFactory() | NodeViewFactory | Creates a ProseMirror NodeViewConstructor backed by a Vue component | | useMarkViewFactory() | MarkViewFactory | Creates a ProseMirror MarkViewConstructor backed by a Vue component | | usePluginViewFactory() | PluginViewFactory | Creates a ProseMirror PluginView factory backed by a Vue component | | useWidgetViewFactory() | WidgetViewFactory | Creates a widget decoration factory backed by a Vue component | | useNodeViewContext() | NodeViewContext | Reads reactive editor state inside a node view component | | useMarkViewContext() | MarkViewContext | Reads reactive editor state inside a mark view component | | usePluginViewContext() | PluginViewContext | Reads reactive editor state inside a plugin view component | | useWidgetViewContext() | WidgetViewContext | Reads reactive editor state inside a widget view component |

NodeViewContext

| Property | Type | Description | |--------------------|-------------------------------------------|----------------------------------------------------------------| | contentRef | VNodeRef | Ref callback/ref for the content-editable container | | dom | HTMLElement | The outer DOM element of this node view | | view | PmEditorView | The ProseMirror editor view | | getPos | () => number \| undefined | Returns the node's current document position | | setAttrs | (attrs: Attrs) => void | Dispatches a transaction updating the node's attributes | | node | ShallowRef<Node> | Reactive ref to the current ProseMirror document node | | selected | ShallowRef<boolean> | Reactive ref indicating whether this node is selected | | decorations | ShallowRef<ReadonlyArray<PmDecoration>> | Reactive ref to the decorations applied to this node | | innerDecorations | ShallowRef<DecorationSource> | Reactive ref to the decorations applied to this node's content |

License

MIT