Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version Packages #1875

Merged
merged 1 commit into from
Sep 14, 2022
Merged

Version Packages #1875

merged 1 commit into from
Sep 14, 2022

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 14, 2022

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@udecode/plate-core@17.0.0

Major Changes

  • #1871 by @zbeyens

    • usePlateStore:
      • Plate no longer has a global store containing all the editor states (zustand). Each editor store is now defined in a React context tree (jotai). If you need to access all the editor states at once (as you could do before), you'll need to build that layer yourself.
      • Plate store is now accessible only below PlateProvider or Plate (provider-less mode). It means it's no longer accessible outside of a Plate React tree. If you have such use-case, you'll need to build your own layer to share the state between your components.
      • You can nest many PlateProvider with different scopes (id prop). Default scope is PLATE_SCOPE
      • Hook usage:
        • const value = usePlateSelectors(id).value()
        • const setValue = usePlateActions(id).value()
        • const [value, setValue] = usePlateStates(id).value()
      • removed from the store:
        • editableProps, use the props instead
        • enabled, use conditional rendering instead
        • isReady, no point anymore as it's now directly ready
      • useEventPlateId is still used to get the last focused editor id.
      • Functions are stored in an object { fn: <here> }
        • const setOnChange = usePlateActions(id).onChange()
        • setOnChange({ fn: newOnChange })
    • Plate
      • if rendered below PlateProvider, it will render PlateSlate > PlateEditable
      • if rendered without PlateProvider, it will render PlateProvider > PlateSlate > PlateEditable
      • default id is no longer main, it's now PLATE_SCOPE
    • PlateProvider
      • Each provider has an optional scope, so you can have multiple providers in the same React tree and use the plate hooks with the corresponding scope.
      • Plate effects are now run in PlateProvider
        • initialValue, value, editor, normalizeInitialValue, normalizeEditor are no longer defined in an effect (SSR support)
      • Props:
        • now extends the previous Plate props
        • if using PlateProvider, set the provider props on it instead of Plate. Plate would only need editableProps and PlateEditableExtendedProps
        • if not using it, set the provider props on Plate
    // Before
    <PlateProvider>
      <Toolbar>
        <AlignToolbarButtons />
      </Toolbar>
    
      <Plate<MyValue> editableProps={editableProps} <MyValue> initialValue={alignValue} plugins={plugins} />
    </PlateProvider>
    
    // After
    <PlateProvider<MyValue> initialValue={alignValue} plugins={plugins}>
      <Toolbar>
        <AlignToolbarButtons />
      </Toolbar>
    
      <Plate<MyValue> editableProps={editableProps} />
    </PlateProvider>
    
    // After (provider-less mode)
    <Plate<MyValue> editableProps={editableProps} initialValue={alignValue} plugins={plugins} />
    • types:
      • store editor is no longer nullable
      • store value is no longer nullable
      • id type is now PlateId
    • renamed:
      • SCOPE_PLATE to PLATE_SCOPE
      • getEventEditorId to getEventPlateId
      • getPlateActions().resetEditor to useResetPlateEditor()
    • removed:
      • plateIdAtom
      • usePlateId for usePlateSelectors().id()
      • EditablePlugins for PlateEditable
      • SlateChildren
      • PlateEventProvider for PlateProvider
      • withPlateEventProvider for withPlateProvider
      • usePlate
      • usePlatesStoreEffect
      • useEventEditorId for useEventPlateId
      • platesStore, platesActions, platesSelectors, usePlatesSelectors
      • getPlateActions for usePlateActions
      • getPlateSelectors for usePlateSelectors
      • getPlateEditorRef for usePlateEditorRef
      • getPlateStore, usePlateStore
      • EditorId for PlateId

Minor Changes

  • #1871 by @zbeyens

    • SSR support
    • useEventPlateId returns:
      • id if defined
      • focused editor id if defined
      • blurred editor id if defined
      • last editor id if defined
      • provider id if defined
      • PLATE_SCOPE otherwise
    • new dep: nanoid
    • PlateProvider
    export interface PlateProviderProps<
      V extends Value = Value,
      E extends PlateEditor<V> = PlateEditor<V>
    > extends PlateProviderEffectsProps<V, E>,
        Partial<Pick<PlateStoreState<V, E>, 'id' | 'editor'>> {
      /**
       * Initial value of the editor.
       * @default [{ children: [{ text: '' }]}]
       */
      initialValue?: PlateStoreState<V>['value'];
    
      /**
       * When `true`, it will normalize the initial value passed to the `editor` once it gets created.
       * This is useful when adding normalization rules on already existing content.
       * @default false
       */
      normalizeInitialValue?: boolean;
    
      scope?: Scope;
    }
    • PlateProviderEffects
    • PlateSlate
    • PlateEditable
    export interface PlateEditableExtendedProps {
      id?: PlateId;
    
      /**
       * The children rendered inside `Slate`, after `Editable`.
       */
      children?: ReactNode;
    
      /**
       * Ref to the `Editable` component.
       */
      editableRef?: Ref<HTMLDivElement>;
    
      /**
       * The first children rendered inside `Slate`, before `Editable`.
       * Slate DOM is not yet resolvable on first render, for that case use `children` instead.
       */
      firstChildren?: ReactNode;
    
      /**
       * Custom `Editable` node.
       */
      renderEditable?: (editable: ReactNode) => ReactNode;
    }
    
    export interface PlateEditableProps<V extends Value = Value>
      extends Omit<TEditableProps<V>, 'id'>,
        PlateEditableExtendedProps {}

Patch Changes

@udecode/plate-code-block@17.0.0

Major Changes

  • #1871 by @zbeyens
    • Removed these imports because of build errors:
      • prismjs/components/prism-django
      • prismjs/components/prism-ejs
      • prismjs/components/prism-php

@udecode/plate-ui@17.0.0

Major Changes

  • #1871 by @zbeyens
    • Removed [ELEMENT_CODE_BLOCK]: CodeBlockElement from Plate UI. You can define it in your app.

@udecode/plate-button@17.0.0

@udecode/plate-find-replace@17.0.0

@udecode/plate-autoformat@17.0.0

@udecode/plate-break@17.0.0

@udecode/plate-combobox@17.0.0

@udecode/plate-node-id@17.0.0

@udecode/plate-normalizers@17.0.0

@udecode/plate-reset-node@17.0.0

@udecode/plate-select@17.0.0

@udecode/plate-trailing-block@17.0.0

@udecode/plate-floating@17.0.0

@udecode/plate-headless@17.0.0

@udecode/plate-media@17.0.0

@udecode/plate-alignment@17.0.0

@udecode/plate-basic-elements@17.0.0

@udecode/plate-basic-marks@17.0.0

@udecode/plate-block-quote@17.0.0

@udecode/plate-font@17.0.0

@udecode/plate-heading@17.0.0

@udecode/plate-highlight@17.0.0

@udecode/plate-horizontal-rule@17.0.0

@udecode/plate-indent@17.0.0

@udecode/plate-indent-list@17.0.0

@udecode/plate-kbd@17.0.0

@udecode/plate-line-height@17.0.0

@udecode/plate-link@17.0.0

@udecode/plate-list@17.0.0

@udecode/plate-mention@17.0.0

@udecode/plate-paragraph@17.0.0

@udecode/plate-table@17.0.0

@udecode/plate@17.0.0

@udecode/plate-selection@17.0.0

@udecode/plate-serializer-csv@17.0.0

@udecode/plate-serializer-docx@17.0.0

@udecode/plate-serializer-html@17.0.0

@udecode/plate-juice@17.0.0

@udecode/plate-serializer-md@17.0.0

@udecode/plate-ui-button@17.0.0

@udecode/plate-ui-combobox@17.0.0

@udecode/plate-ui-cursor@17.0.0

@udecode/plate-ui-dnd@17.0.0

@udecode/plate-ui-find-replace@17.0.0

@udecode/plate-ui-alignment@17.0.0

@udecode/plate-ui-block-quote@17.0.0

@udecode/plate-ui-code-block@17.0.0

@udecode/plate-ui-excalidraw@17.0.0

@udecode/plate-ui-font@17.0.0

@udecode/plate-ui-horizontal-rule@17.0.0

@udecode/plate-ui-line-height@17.0.0

@udecode/plate-ui-link@17.0.0

@udecode/plate-ui-list@17.0.0

@udecode/plate-ui-media@17.0.0

@udecode/plate-ui-mention@17.0.0

@udecode/plate-ui-table@17.0.0

@udecode/plate-ui-placeholder@17.0.0

@udecode/plate-ui-popper@17.0.0

@udecode/plate-styled-components@17.0.0

@udecode/plate-ui-toolbar@17.0.0

@vercel
Copy link

vercel bot commented Sep 14, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
plate-examples ❌ Failed (Inspect) Sep 14, 2022 at 9:00PM (UTC)
1 Ignored Deployment
Name Status Preview Updated
plate ⬜️ Ignored (Inspect) Sep 14, 2022 at 9:00PM (UTC)

@vercel vercel bot temporarily deployed to Preview – plate-examples September 14, 2022 21:00 Inactive
@zbeyens zbeyens merged commit 6d3a9ae into main Sep 14, 2022
@zbeyens zbeyens deleted the changeset-release/main branch September 14, 2022 21:04
@zbeyens zbeyens added this to the 17 milestone Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant