Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blocksuite/shared

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blocksuite/shared - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

3

dist/operations.d.ts
import type { Quill } from 'quill';
import { BaseBlockModel, Store } from '@blocksuite/store';
import { BlockHost, Detail, SelectionPosition } from './types';
import { BlockHost, Detail, SelectionPosition, SelectOptions } from './types';
declare type ExtendedModel = BaseBlockModel & Record<string, any>;

@@ -22,3 +22,4 @@ export declare function createEvent<T extends keyof WindowEventMap>(type: T, detail: Detail<T>): CustomEvent<Detail<T>>;

export declare function commonTextActiveHandler(position: SelectionPosition, editableContainer: Element): void;
export declare function commonPassCursorHandler(id: string, selection: BlockHost['selection'], selectOptions?: SelectOptions): void;
export {};
//# sourceMappingURL=operations.d.ts.map

@@ -318,2 +318,13 @@ import { TextEntity } from '@blocksuite/store';

}
export function commonPassCursorHandler(id, selection, selectOptions) {
if (selectOptions?.needFocus) {
const lastSelectionPosition = selection.lastSelectionPosition;
if (selectOptions?.from === 'next') {
selection.activatePreviousBlock(id, lastSelectionPosition);
}
else {
selection.activateNextBlock(id, lastSelectionPosition);
}
}
}
//# sourceMappingURL=operations.js.map
import type { BaseBlockModel, Store } from '@blocksuite/store';
import { Point } from './rect';
export declare type SelectionPosition = 'start' | 'end' | Point;
export declare type SelectOptions = {
needFocus?: boolean;
from?: 'previous' | 'next';
};
/** Common context interface definition for block models. */

@@ -8,9 +12,9 @@ export interface BlockHost {

selection: {
addBlockSelectedListener: (blockId: string, handler: (selected: boolean) => void) => void;
addBlockSelectedListener: (blockId: string, handler: (selectionInfo?: SelectOptions) => void) => void;
removeBlockSelectedListener: (blockId: string) => void;
addBlockActiveListener: (blockId: string, handler: (position: SelectionPosition) => void) => void;
removeBlockActiveListener: (blockId: string) => void;
activatePreviousBlock: (blockId: string, position?: SelectionPosition) => void;
activateNextBlock: (blockId: string, position?: SelectionPosition) => void;
selectAllBlocks: () => void;
selectionInfo: SelectionInfo;
lastSelectionPosition: SelectionPosition;
};

@@ -17,0 +21,0 @@ }

{
"name": "@blocksuite/shared",
"version": "0.2.1",
"version": "0.2.2",
"type": "module",

@@ -11,3 +11,3 @@ "description": "",

"dependencies": {
"@blocksuite/store": "0.2.1",
"@blocksuite/store": "0.2.2",
"hotkeys-js": "^3.10.0"

@@ -14,0 +14,0 @@ },

import type { Quill } from 'quill';
import { BaseBlockModel, Store, TextEntity } from '@blocksuite/store';
import { BlockHost, Detail, SelectionPosition } from './types';
import { BlockHost, Detail, SelectionPosition, SelectOptions } from './types';
import { ALLOW_DEFAULT, PREVENT_DEFAULT } from './consts';

@@ -416,1 +416,16 @@ import { Point, Rect } from './rect';

}
export function commonPassCursorHandler(
id: string,
selection: BlockHost['selection'],
selectOptions?: SelectOptions
) {
if (selectOptions?.needFocus) {
const lastSelectionPosition = selection.lastSelectionPosition;
if (selectOptions?.from === 'next') {
selection.activatePreviousBlock(id, lastSelectionPosition);
} else {
selection.activateNextBlock(id, lastSelectionPosition);
}
}
}

@@ -6,2 +6,7 @@ import type { BaseBlockModel, Store } from '@blocksuite/store';

export type SelectOptions = {
needFocus?: boolean;
from?: 'previous' | 'next';
};
/** Common context interface definition for block models. */

@@ -14,12 +19,5 @@ export interface BlockHost {

blockId: string,
handler: (selected: boolean) => void
handler: (selectionInfo?: SelectOptions) => void
) => void;
removeBlockSelectedListener: (blockId: string) => void;
addBlockActiveListener: (
blockId: string,
handler: (position: SelectionPosition) => void
) => void;
removeBlockActiveListener: (blockId: string) => void;
activatePreviousBlock: (

@@ -31,2 +29,4 @@ blockId: string,

selectAllBlocks: () => void;
selectionInfo: SelectionInfo;
lastSelectionPosition: SelectionPosition;
};

@@ -33,0 +33,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc