Skip to content

Commit

Permalink
🔨 fix mention build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ila-park committed Mar 22, 2024
1 parent 73ef3cd commit 2ede2d5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 53 deletions.
17 changes: 0 additions & 17 deletions packages/docs/src/components/examples/getting-started/maximum.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,10 @@ import React, { useState } from 'react';
import { edybaraPresetSchema, edybaraPresetPlugins } from '@edybara/preset';
import doc from '@site/src/pages/lorem-ipsum.json';
import { Node } from 'prosemirror-model';
import { faker } from '@faker-js/faker';
import { EdybaraMentionView } from '@edybara/mention';

const persons = Array.from({ length: 200 }).map(() => ({
id: faker.string.uuid(),
name: faker.person.fullName(),
icon: faker.image.avatar(),
}));

const schema = edybaraPresetSchema();
const plugins = edybaraPresetPlugins({
schema,
mention: {
markType: schema.marks['mention'],
commandView: (view, plugin) =>
new EdybaraMentionView(view, plugin, (keyword) => {
return persons.filter((person) =>
person.name.toLowerCase().includes(keyword.toLowerCase()),
);
}),
},
});

export const Maximum = (props: ProseMirrorProps) => {
Expand Down
34 changes: 17 additions & 17 deletions packages/docs/src/components/examples/packages/mention.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
edybaraParagraphPlugins,
} from '@edybara/paragraph';
import { edybaraMenubarPlugins } from '@edybara/menubar';
import {
EdybaraMentionView,
edybaraMentionMarks,
edybaraMentionPlugins,
} from '@edybara/mention';
// import {
// EdybaraMentionView,
// edybaraMentionMarks,
// edybaraMentionPlugins,
// } from '@edybara/mention';
import { faker } from '@faker-js/faker';

const persons = Array.from({ length: 200 }).map(() => ({
Expand All @@ -30,25 +30,25 @@ const schema = new Schema({
...edybaraParagraphNodes(),
},
marks: {
...edybaraMentionMarks({
markName: 'mention',
}),
// ...edybaraMentionMarks({
// markName: 'mention',
// }),
},
});

const plugins: Plugin[] = [
...edybaraParagraphPlugins({
nodeType: schema.nodes['paragraph'],
}),
...edybaraMentionPlugins({
markType: schema.marks['mention'],
commandView: (view, plugin) =>
new EdybaraMentionView(view, plugin, (keyword) => {
return persons.filter((person) =>
person.name.toLowerCase().includes(keyword.toLowerCase()),
);
}),
}),
// ...edybaraMentionPlugins({
// markType: schema.marks['mention'],
// commandView: (view, plugin) =>
// new EdybaraMentionView(view, plugin, (keyword) => {
// return persons.filter((person) =>
// person.name.toLowerCase().includes(keyword.toLowerCase()),
// );
// }),
// }),
...edybaraMenubarPlugins({
mention: {
mentionMarkType: schema.marks['mention'],
Expand Down
17 changes: 0 additions & 17 deletions packages/docs/src/components/examples/packages/preset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,10 @@ import React, { useState } from 'react';
import { edybaraPresetSchema, edybaraPresetPlugins } from '@edybara/preset';
import doc from '@site/src/pages/lorem-ipsum.json';
import { Node } from 'prosemirror-model';
import { faker } from '@faker-js/faker';
import { EdybaraMentionView } from '@edybara/mention';

const persons = Array.from({ length: 200 }).map(() => ({
id: faker.string.uuid(),
name: faker.person.fullName(),
icon: faker.image.avatar(),
}));

const schema = edybaraPresetSchema();
const plugins = edybaraPresetPlugins({
schema,
mention: {
markType: schema.marks['mention'],
commandView: (view, plugin) =>
new EdybaraMentionView(view, plugin, (keyword) => {
return persons.filter((person) =>
person.name.toLowerCase().includes(keyword.toLowerCase()),
);
}),
},
});

export const PresetExample = (props: ProseMirrorProps) => {
Expand Down
2 changes: 0 additions & 2 deletions packages/menubar/src/components/mention/mention.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { EdybaraButton, html } from '@edybara/ui';
import { addMention } from '@edybara/mention';
import { useContext } from 'preact/hooks';
import { EdybaraMenubarContext } from '../context';

Expand All @@ -14,7 +13,6 @@ export const EdybaraMenubarMentionButtons = () => {
<${EdybaraButton}
className="edybara-icon-button"
onClick=${() => {
addMention()(context.editorView.state, context.editorView.dispatch);
context.editorView.focus();
}}>
<i class="ri-at-line"></i>
Expand Down

0 comments on commit 2ede2d5

Please sign in to comment.