New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@yoopta/code

Package Overview
Dependencies
Maintainers
0
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yoopta/code - npm Package Versions

1345
13

4.9.0

Diff
dargo05
published 4.9.0 •

Changelog

Source

[4.9.0] - 2024-10-27

Breaking Changes

  • Changed API for editor.on('change', changeHandler);
// before
editor.on('change', (value: YooptaChildrenValue) => {
  setValue(value);
});

// now
editor.on('change', (options: YooptaEventChangePayload) => {
  const { value, operations } = options;
  setValue(value);
});

// [!!!But I highly recommend start to use new `onChange` prop in <YooptaEditor value={value} onChange={newValue => setValue(newValue)} />;

Added

Undo/redo now available!

  • New Editor API methods for history:
    • editor.undo: ({ scroll?: boolean }?: UndoRedoOptions) => void
    • editor.redo: ({ scroll?: boolean }?: UndoRedoOptions) => void
    • editor.historyStack: Record
    • editor.withoutSavingHistory: (fn: () => void): void
    • editor.withSavingHistory: (fn: () => void): void
    • editor.isSavingHistory: (): boolean | undefined
    • editor.withoutMergingHistory: (fn: () => void): void
    • editor.withMergingHistory: (fn: () => void): void
    • editor.isMergingHistory: (): boolean | undefined

New powerful editor.applyTransforms method and operations API. Now, every time the content is changed, the corresponding operation is called, which passes through the editor.applyTransforms

  • editor.path: YooptaPath
  • editor.setPath: (path: YooptaPath) => void;
  • Blocks.getBlock: (editor: YooEditor, options: GetBlockOptions) => YooptaBlockData
  • Blocks.getBlockSlate: (editor: YooEditor, options: GetBlockSlateOptions) => SlateEditor
  • Blocks.buildBlockData: (block?: BuildBlockDataOptions) => YooptaBlockData
  • Blocks.mergeBlock: () => void
export type YooptaPath = {
  current: YooptaPathIndex, // current selected block
  selected?: number[] | null, // array of selected blocks
};

Fixed

  • editor.toggleBlock -fixed toggling between complex block elements
  • editor.splitBlock - fixed split between complex block elements
  • onChange now does not fire during initialization
  • editor.duplicateBlock - fixed for Code block
  • Fixed moving up/down cursor in list plugins
  • Fixed trigger of "/" for ActionMenu

Removed

  • Editor API changes:
    • editor.applyChanges - removed
    • editor.selection - removed (changed to editor.path)
    • editor.setSelection - removed (changed to editor.setPath)
    • editor.setBlockSelected - removed (changed to editor.setPath)
    • editor.insertBlocks - removed
    • editor.deleteBlocks - removed
    • editor.createBlock - removed. Use editor.insertBlock instead

Examples

  • Added new example for operations API
  • Added new example for undo/redo
  • Updated UI for HTML exports
  • Updated UI for Markdown exports
dargo05
published 4.8.5-rc.11 •
dargo05
published 4.8.5-rc.10 •
dargo05
published 4.8.5-rc.9 •
dargo05
published 4.8.5-rc.8 •
dargo05
published 4.8.5-rc.7 •
dargo05
published 4.8.5-rc.6 •
dargo05
published 4.8.5-rc.5 •
dargo05
published 4.8.5-rc.4 •
dargo05
published 4.8.4 •