Skip to content

Commit

Permalink
Merge branch 'main' into fix/tabbable-read-only
Browse files Browse the repository at this point in the history
  • Loading branch information
12joan authored Oct 2, 2023
2 parents d87bc70 + 66a32cc commit 64c496a
Show file tree
Hide file tree
Showing 36 changed files with 659 additions and 658 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
yarn-cache-folder-
- name: Install
run: yarn install
run: YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install

- name: Build Registry
run: yarn build:registry
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
yarn-cache-folder-
- name: Install Dependencies
# run: yarn install --immutable
run: YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install

- name: Prepare Release
Expand Down
225 changes: 113 additions & 112 deletions apps/www/src/registry/default/example/playground-demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,124 +126,125 @@ export const usePlaygroundPlugins = ({

return useMemo(
() => {
const plugins = [
// Nodes
createParagraphPlugin({ enabled: !!enabled.p }),
createHeadingPlugin({ enabled: !!enabled.heading }),
createBlockquotePlugin({ enabled: !!enabled.blockquote }),
createCodeBlockPlugin({ enabled: !!enabled.code_block }),
createHorizontalRulePlugin({ enabled: !!enabled.hr }),
createLinkPlugin({ ...linkPlugin, enabled: !!enabled.a }),
createListPlugin({
enabled: id === 'list' || !!enabled.list,
}),
createImagePlugin({ enabled: !!enabled.img }),
createMediaEmbedPlugin({ enabled: !!enabled.media_embed }),
createCaptionPlugin({ ...captionPlugin, enabled: !!enabled.caption }),
createMentionPlugin({
enabled: !!enabled.mention,
options: {
triggerPreviousCharPattern: /^$|^[\s"']$/,
},
}),
createTablePlugin({ enabled: !!enabled.table }),
createTodoListPlugin({ enabled: !!enabled.action_item }),
createExcalidrawPlugin({ enabled: !!enabled.excalidraw }),
return createPlugins(
[
// Nodes
createParagraphPlugin({ enabled: !!enabled.p }),
createHeadingPlugin({ enabled: !!enabled.heading }),
createBlockquotePlugin({ enabled: !!enabled.blockquote }),
createCodeBlockPlugin({ enabled: !!enabled.code_block }),
createHorizontalRulePlugin({ enabled: !!enabled.hr }),
createLinkPlugin({ ...linkPlugin, enabled: !!enabled.a }),
createListPlugin({
enabled: id === 'list' || !!enabled.list,
}),
createImagePlugin({ enabled: !!enabled.img }),
createMediaEmbedPlugin({ enabled: !!enabled.media_embed }),
createCaptionPlugin({ ...captionPlugin, enabled: !!enabled.caption }),
createMentionPlugin({
enabled: !!enabled.mention,
options: {
triggerPreviousCharPattern: /^$|^[\s"']$/,
},
}),
createTablePlugin({ enabled: !!enabled.table }),
createTodoListPlugin({ enabled: !!enabled.action_item }),
createExcalidrawPlugin({ enabled: !!enabled.excalidraw }),

// Marks
createBoldPlugin({ enabled: !!enabled.bold }),
createItalicPlugin({ enabled: !!enabled.italic }),
createUnderlinePlugin({ enabled: !!enabled.underline }),
createStrikethroughPlugin({ enabled: !!enabled.strikethrough }),
createCodePlugin({ enabled: !!enabled.code }),
createSubscriptPlugin({ enabled: !!enabled.subscript }),
createSuperscriptPlugin({ enabled: !!enabled.superscript }),
createFontColorPlugin({ enabled: !!enabled.color }),
createFontBackgroundColorPlugin({
enabled: !!enabled.backgroundColor,
}),
createFontSizePlugin({ enabled: !!enabled.fontSize }),
createHighlightPlugin({ enabled: !!enabled.highlight }),
createKbdPlugin({ enabled: !!enabled.kbd }),
// Marks
createBoldPlugin({ enabled: !!enabled.bold }),
createItalicPlugin({ enabled: !!enabled.italic }),
createUnderlinePlugin({ enabled: !!enabled.underline }),
createStrikethroughPlugin({ enabled: !!enabled.strikethrough }),
createCodePlugin({ enabled: !!enabled.code }),
createSubscriptPlugin({ enabled: !!enabled.subscript }),
createSuperscriptPlugin({ enabled: !!enabled.superscript }),
createFontColorPlugin({ enabled: !!enabled.color }),
createFontBackgroundColorPlugin({
enabled: !!enabled.backgroundColor,
}),
createFontSizePlugin({ enabled: !!enabled.fontSize }),
createHighlightPlugin({ enabled: !!enabled.highlight }),
createKbdPlugin({ enabled: !!enabled.kbd }),

// Block Style
createAlignPlugin({ ...alignPlugin, enabled: !!enabled.align }),
createIndentPlugin({ ...indentPlugin, enabled: !!enabled.indent }),
createIndentListPlugin({
...indentPlugin,
enabled: id === 'indentlist' || !!enabled.listStyleType,
}),
createLineHeightPlugin({
...lineHeightPlugin,
enabled: !!enabled.lineHeight,
}),
// Block Style
createAlignPlugin({ ...alignPlugin, enabled: !!enabled.align }),
createIndentPlugin({ ...indentPlugin, enabled: !!enabled.indent }),
createIndentListPlugin({
...indentPlugin,
enabled: id === 'indentlist' || !!enabled.listStyleType,
}),
createLineHeightPlugin({
...lineHeightPlugin,
enabled: !!enabled.lineHeight,
}),

// Functionality
createAutoformatPlugin({
enabled: !!enabled.autoformat,
options: autoformatOptions,
}),
createBlockSelectionPlugin({
options: {
sizes: {
top: 0,
bottom: 0,
// Functionality
createAutoformatPlugin({
enabled: !!enabled.autoformat,
options: autoformatOptions,
}),
createBlockSelectionPlugin({
options: {
sizes: {
top: 0,
bottom: 0,
},
},
},
enabled: id === 'blockselection' || !!enabled.blockSelection,
}),
createComboboxPlugin({ enabled: !!enabled.combobox }),
createDndPlugin({
options: { enableScroller: true },
enabled: !!enabled.dnd,
}),
createEmojiPlugin({ ...emojiPlugin, enabled: !!enabled.emoji }),
createExitBreakPlugin({
...exitBreakPlugin,
enabled: !!enabled.exitBreak,
}),
createNodeIdPlugin({ enabled: !!enabled.nodeId }),
createNormalizeTypesPlugin({
...forcedLayoutPlugin,
enabled: !!enabled.normalizeTypes,
}),
createResetNodePlugin({
...resetBlockTypePlugin,
enabled: !!enabled.resetNode,
}),
createSelectOnBackspacePlugin({
...selectOnBackspacePlugin,
enabled: !!enabled.selectOnBackspace,
}),
createSingleLinePlugin({
enabled: id === 'singleline' || !!enabled.singleLine,
}),
createSoftBreakPlugin({
...softBreakPlugin,
enabled: !!enabled.softBreak,
}),
createTabbablePlugin({
...tabbablePlugin,
enabled: !!enabled.tabbable,
}),
createTrailingBlockPlugin({
...trailingBlockPlugin,
enabled: id !== 'singleline' && !!enabled.trailingBlock,
}),
{ ...dragOverCursorPlugin, enabled: !!enabled.dragOverCursor },

// Collaboration
createCommentsPlugin({ enabled: !!enabled.comment }),
enabled: id === 'blockselection' || !!enabled.blockSelection,
}),
createComboboxPlugin({ enabled: !!enabled.combobox }),
createDndPlugin({
options: { enableScroller: true },
enabled: !!enabled.dnd,
}),
createEmojiPlugin({ ...emojiPlugin, enabled: !!enabled.emoji }),
createExitBreakPlugin({
...exitBreakPlugin,
enabled: !!enabled.exitBreak,
}),
createNodeIdPlugin({ enabled: !!enabled.nodeId }),
createNormalizeTypesPlugin({
...forcedLayoutPlugin,
enabled: !!enabled.normalizeTypes,
}),
createResetNodePlugin({
...resetBlockTypePlugin,
enabled: !!enabled.resetNode,
}),
createSelectOnBackspacePlugin({
...selectOnBackspacePlugin,
enabled: !!enabled.selectOnBackspace,
}),
createSingleLinePlugin({
enabled: id === 'singleline' || !!enabled.singleLine,
}),
createSoftBreakPlugin({
...softBreakPlugin,
enabled: !!enabled.softBreak,
}),
createTabbablePlugin({
...tabbablePlugin,
enabled: !!enabled.tabbable,
}),
createTrailingBlockPlugin({
...trailingBlockPlugin,
enabled: id !== 'singleline' && !!enabled.trailingBlock,
}),
{ ...dragOverCursorPlugin, enabled: !!enabled.dragOverCursor },

// Deserialization
createDeserializeDocxPlugin({ enabled: !!enabled.deserializeDocx }),
createDeserializeMdPlugin({ enabled: !!enabled.deserializeMd }),
createJuicePlugin({ enabled: !!enabled.juice }),
];
// Collaboration
createCommentsPlugin({ enabled: !!enabled.comment }),

return createPlugins(plugins, {
components,
});
// Deserialization
createDeserializeDocxPlugin({ enabled: !!enabled.deserializeDocx }),
createDeserializeMdPlugin({ enabled: !!enabled.deserializeMd }),
createJuicePlugin({ enabled: !!enabled.juice }),
],
{
components,
}
);
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[enabled]
Expand Down
26 changes: 16 additions & 10 deletions config/eslint/bases/next.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,31 @@ module.exports = {
'import/no-unresolved': [
'error',
{
ignore: ['^@/plate'],
ignore: ['^@/'],
},
],
'import/prefer-default-export': 'off',
},
overrides: [
{
files: ['**/packages/**'],
excludedFiles: ['**/*.test.*', '**/*.spec.*', '**/*.fixtures.*', '**/__tests__/**/*', '**/apps/**/*'],
excludedFiles: [
'**/*.test.*',
'**/*.spec.*',
'**/*.fixtures.*',
'**/__tests__/**/*',
'**/apps/**/*',
],
rules: {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: false,
includeInternal: false,
includeTypes: false,
},
],
}
'error',
{
devDependencies: false,
includeInternal: false,
includeTypes: false,
},
],
},
},
{
files: ['apps/www/next.config.mjs'],
Expand Down
15 changes: 14 additions & 1 deletion config/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {}
"compilerOptions": {
"baseUrl": "../",
"paths": {
"@/plate/*": ["apps/www/src/lib/plate/*"],
"@/lib/*": ["apps/www/src/lib/*"],
"@/types/*": ["apps/www/src/types/*"],
"@/styles/*": ["apps/www/src/styles/*"],
"@/components/*": ["apps/www/src/components/*"],
"@/registry/*": ["apps/www/src/registry/*"],
"@/__registry__/*": ["apps/www/src/__registry__/*"],
"@/hooks/*": ["apps/www/src/hooks/*"],
"@/config/*": ["apps/www/src/config/*"]
}
}
}
16 changes: 4 additions & 12 deletions config/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export default defineConfig((opts) => {
entry: [INPUT_FILE],
format: ['cjs', 'esm'],
skipNodeModulesBundle: true,
dts: true,
dts: {
resolve: false,
},
sourcemap: true,
clean: true,
esbuildPlugins: [
Expand All @@ -37,16 +39,6 @@ export default defineConfig((opts) => {
console.info('Build succeeded!');
},
silent: true,
// plugins: [
// {
// name: 'add-mjs',
// setup(build: any) {
// build.onResolve({ filter: /.*/ }, (args: any) => {
// if (args.importer)
// return { path: args.path + '.mjs', external: true };
// });
// },
// },
// ],
plugins: [],
};
});
7 changes: 5 additions & 2 deletions jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const appRoot = require('app-root-path');

const packageJson = require(`${process.cwd()}/package.json`);
const packageName = packageJson.name ?? 'plate';
const { compilerOptions: baseTsConfig } = require(`${appRoot}/tsconfig.json`);
const {
compilerOptions: baseTsConfig,
} = require(`${appRoot}/config/tsconfig.test.json`);

// Take the paths from tsconfig automatically from base tsconfig.json
// @link https://kulshekhar.github.io/ts-jest/docs/paths-mapping
Expand All @@ -25,7 +27,8 @@ Object.keys(aliases).forEach((key) => {
modules[`^${key}$`] = `<rootDir>/packages/${value}/src`;
});

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
/** @type {import('ts-jest').JestConfigWithTsJest} */
//@ts-check
module.exports = {
displayName: packageName,
collectCoverageFrom: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/** @jsx jsx */

import { autoformatPlugin } from '@/plate/demo/plugins/autoformatPlugin';
import { mockPlugin } from '@udecode/plate-common';
import { jsx } from '@udecode/plate-test-utils';
import { withReact } from 'slate-react';
import { autoformatPlugin } from 'www/src/lib/plate/demo/plugins/autoformatPlugin';

import { withAutoformat } from '../../../withAutoformat';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/** @jsx jsx */

import { autoformatPlugin } from '@/plate/demo/plugins/autoformatPlugin';
import { preFormat } from '@/plate/demo/plugins/autoformatUtils';
import { AutoformatPlugin } from '@udecode/plate-autoformat';
import {
ELEMENT_CODE_BLOCK,
Expand All @@ -18,6 +16,8 @@ import {
import { jsx } from '@udecode/plate-test-utils';
import { Range } from 'slate';
import { withReact } from 'slate-react';
import { autoformatPlugin } from 'www/src/lib/plate/demo/plugins/autoformatPlugin';
import { preFormat } from 'www/src/lib/plate/demo/plugins/autoformatUtils';

import { withAutoformat } from '../../../withAutoformat';

Expand Down
Loading

0 comments on commit 64c496a

Please sign in to comment.