Skip to content

Commit

Permalink
feat(text editor mentions): use mention parser in prosemirror adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
john-traas committed Sep 5, 2024
1 parent f7b03b1 commit b94a1a8
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { createMenuStateTrackingPlugin } from './plugins/menu-state-tracking-plu
import { createActionBarInteractionPlugin } from './plugins/menu-action-interaction-plugin';
import { mention } from './mentions/node-schema-extender';
import { createTriggerPlugin } from './plugins/trigger-plugin';
import { createMentionParseTransaction } from './mentions/parse-mentions';

/**
* The ProseMirror adapter offers a rich text editing experience with markdown support.
Expand Down Expand Up @@ -353,10 +354,19 @@ export class ProsemirrorAdapter {
);

if (this.value) {
this.updateView(this.value);
await this.updateView(this.value);
this.parseMentions(this.view);
}
}

private parseMentions = (view) => {
const { state } = view;
const transaction = createMentionParseTransaction(state, this.schema);
if (transaction) {
this.view.dispatch(transaction);
}
};

private initializeSchema() {
const nodes = schema.spec.nodes
.append({
Expand Down

0 comments on commit b94a1a8

Please sign in to comment.