Skip to content

Commit

Permalink
feat
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfeng33 committed Apr 26, 2024
1 parent 206ed90 commit f4f47cc
Show file tree
Hide file tree
Showing 18 changed files with 190 additions and 173 deletions.
2 changes: 1 addition & 1 deletion apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"@radix-ui/react-toolbar": "^1.0.4",
"@radix-ui/react-tooltip": "^1.0.7",
"@udecode/cn": "workspace:^",
"@udecode/plate-affinity-marks": "workspace:^",
"@udecode/plate-alignment": "workspace:^",
"@udecode/plate-autoformat": "workspace:^",
"@udecode/plate-basic-elements": "workspace:^",
Expand Down Expand Up @@ -83,6 +82,7 @@
"@udecode/plate-line-height": "workspace:^",
"@udecode/plate-link": "workspace:^",
"@udecode/plate-list": "workspace:^",
"@udecode/plate-marks-affinity": "workspace:^",
"@udecode/plate-media": "workspace:^",
"@udecode/plate-mention": "workspace:^",
"@udecode/plate-node-id": "workspace:^",
Expand Down
32 changes: 23 additions & 9 deletions apps/www/src/registry/default/example/playground-demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { trailingBlockPlugin } from '@/plate/demo/plugins/trailingBlockPlugin';
import { MENTIONABLES } from '@/plate/demo/values/mentionables';
import { usePlaygroundValue } from '@/plate/demo/values/usePlaygroundValue';
import { cn } from '@udecode/cn';
import { createMarkAffinityPlugin } from '@udecode/plate-affinity-marks';
import { createAlignPlugin } from '@udecode/plate-alignment';
import { createAutoformatPlugin } from '@udecode/plate-autoformat';
import {
Expand All @@ -34,6 +33,10 @@ import {
createSubscriptPlugin,
createSuperscriptPlugin,
createUnderlinePlugin,
MARK_BOLD,
MARK_ITALIC,
MARK_STRIKETHROUGH,
MARK_UNDERLINE,
} from '@udecode/plate-basic-marks';
import {
createBlockquotePlugin,
Expand All @@ -50,7 +53,7 @@ import {
ELEMENT_CODE_BLOCK,
} from '@udecode/plate-code-block';
import { createComboboxPlugin } from '@udecode/plate-combobox';
import { createCommentsPlugin } from '@udecode/plate-comments';
import { createCommentsPlugin, MARK_COMMENT } from '@udecode/plate-comments';
import {
createPlugins,
Plate,
Expand All @@ -64,6 +67,11 @@ import {
createFontBackgroundColorPlugin,
createFontColorPlugin,
createFontSizePlugin,
MARK_BG_COLOR,
MARK_COLOR,
MARK_FONT_FAMILY,
MARK_FONT_SIZE,
MARK_FONT_WEIGHT,
} from '@udecode/plate-font';
import {
createHeadingPlugin,
Expand All @@ -84,6 +92,7 @@ import { createColumnPlugin } from '@udecode/plate-layout';
import { createLineHeightPlugin } from '@udecode/plate-line-height';
import { createLinkPlugin } from '@udecode/plate-link';
import { createListPlugin, createTodoListPlugin } from '@udecode/plate-list';
import { createMarkAffinityPlugin } from '@udecode/plate-marks-affinity';
import {
createImagePlugin,
createMediaEmbedPlugin,
Expand Down Expand Up @@ -194,13 +203,18 @@ export const usePlaygroundPlugins = ({
createStrikethroughPlugin({ enabled: !!enabled.strikethrough }),
createMarkAffinityPlugin({
options: {
pressRightArrowAtBoundary: (
editor,
currentEndLeafEntry,
nextLeafEntry
) => {
console.log(editor, 'fj');
},
validMarks: [
MARK_BG_COLOR,
MARK_BOLD,
MARK_COLOR,
MARK_UNDERLINE,
MARK_FONT_FAMILY,
MARK_FONT_SIZE,
MARK_FONT_WEIGHT,
MARK_ITALIC,
MARK_STRIKETHROUGH,
MARK_COMMENT,
],
},
}),
createCodePlugin({ enabled: !!enabled.code }),
Expand Down
133 changes: 0 additions & 133 deletions packages/affinity-mark/src/createMarkAffinityPlugin.ts

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@udecode/plate-affinity-marks",
"name": "@udecode/plate-marks-affinity",
"version": "31.0.0",
"description": "Basic marks plugin for Plate",
"license": "MIT",
Expand Down
13 changes: 13 additions & 0 deletions packages/mark-affinity/src/createMarkAffinityPlugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { createPluginFactory } from '@udecode/plate-common';

import { MarkAffinityPlugin } from './types';
import { withMarkAffinity } from './withMarkAffinity';

export const KEY_MARK_AFFINITY = 'mark-affinity';

export const createMarkAffinityPlugin = createPluginFactory<MarkAffinityPlugin>(
{
key: KEY_MARK_AFFINITY,
withOverrides: withMarkAffinity,
}
);
9 changes: 9 additions & 0 deletions packages/mark-affinity/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @file Automatically generated by barrelsby.
*/

export * from './createMarkAffinityPlugin';
export * from './types';
export * from './withMarkAffinity';
export * from './queries/index';
export * from './transforms/index';
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@udecode/plate-common';
import { NodeEntry, Path } from 'slate';

import { MarkBoundary } from './types';
import { MarkBoundary } from '../types';

export const getMarkBoundary = (editor: PlateEditor): MarkBoundary | null => {
const { selection } = editor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getNodeProps, PlateEditor, TText } from '@udecode/plate-common';
import isEqual from 'lodash/isEqual';

import { MarkBoundary } from './types';
import { MarkBoundary } from '../types';

const IS_FIREFOX = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
* @file Automatically generated by barrelsby.
*/

export * from './createMarkAffinityPlugin';
export * from './getMarkBoundary';
export * from './getMarkBoundaryAffinity';
export * from './setMarkBoundaryAffinity';
export * from './types';
5 changes: 5 additions & 0 deletions packages/mark-affinity/src/transforms/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @file Automatically generated by barrelsby.
*/

export * from './setMarkBoundaryAffinity';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getEndPoint, getNodeProps, PlateEditor } from '@udecode/plate-common';
import { Point } from 'slate';

import { MarkBoundary } from './types';
import { MarkBoundary } from '../types';

export const setMarkBoundaryAffinity = (
editor: PlateEditor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import { TText } from '@udecode/plate-common';
import { NodeEntry } from 'slate';

export interface MarkAffinityPlugin {
pressRightArrowAtBoundary?: (
editor: any,
currentEndLeafEntry?: NodeEntry<TText>,
nextLeafEntry?: NodeEntry<TText>
) => void;
validMarks?: string[];
}

export type MarkBoundary =
Expand Down
Loading

0 comments on commit f4f47cc

Please sign in to comment.