@blocksuite/global
Advanced tools
Comparing version 0.5.0-20230302205056-4385b7a to 0.5.0-20230303192351-13b0dd7
@@ -70,2 +70,3 @@ export declare const TextIcon: import("lit-html").TemplateResult<1>; | ||
export declare const ViewBarIcon: import("lit-html").TemplateResult<1>; | ||
export declare const TransparentIcon: import("lit-html").TemplateResult<1>; | ||
//# sourceMappingURL=icons.d.ts.map |
@@ -5,3 +5,3 @@ import type { BaseBlockModel } from '@blocksuite/store'; | ||
export { DisposableGroup, flattenDisposable } from './utils/disposable.js'; | ||
export { Signal } from './utils/signal.js'; | ||
export { Slot } from './utils/slot.js'; | ||
export { caretRangeFromPoint, isFirefox, isWeb } from './utils/web.js'; | ||
@@ -8,0 +8,0 @@ export declare const SYS_KEYS: Set<string>; |
export { DisposableGroup, flattenDisposable } from './utils/disposable.js'; | ||
export { Signal } from './utils/signal.js'; | ||
export { Slot } from './utils/slot.js'; | ||
export { caretRangeFromPoint, isFirefox, isWeb } from './utils/web.js'; | ||
@@ -75,3 +75,4 @@ export const SYS_KEYS = new Set(['id', 'flavour', 'children']); | ||
} | ||
export const getDefaultPlaygroundURL = (isE2E) => new URL(`http://localhost:${isE2E ? 4173 : 5173}/`); | ||
export const getDefaultPlaygroundURL = (isE2E) => new URL(`http://localhost:5173/`); | ||
// new URL(`http://localhost:${isE2E ? 4173 : 5173}/`); | ||
//# sourceMappingURL=utils.js.map |
@@ -32,2 +32,14 @@ export const isWeb = typeof window !== 'undefined'; | ||
} | ||
// See https://github.com/toeverything/blocksuite/issues/1382 | ||
const rangeRects = range?.getClientRects(); | ||
if (rangeRects && | ||
rangeRects.length === 2 && | ||
range.startOffset === range.endOffset && | ||
clientY < rangeRects[0].y + rangeRects[0].height) { | ||
const deltaX = (rangeRects[0].x | 0) - (rangeRects[1].x | 0); | ||
if (deltaX > 0) { | ||
range.setStart(range.startContainer, range.startOffset - 1); | ||
range.setEnd(range.endContainer, range.endOffset - 1); | ||
} | ||
} | ||
// This is a workaround | ||
@@ -34,0 +46,0 @@ // Sometimes the point be covered by the format bar, |
@@ -72,2 +72,3 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
enable_slash_menu: boolean; | ||
/** | ||
@@ -77,2 +78,4 @@ * Block selection can trigger format bar | ||
enable_block_selection_format_bar: boolean; | ||
enable_toggle_block: boolean; | ||
enable_edgeless_toolbar: boolean; | ||
@@ -96,3 +99,3 @@ readonly: Record<string, boolean>; | ||
declare type EmbedType = 'image' | 'video' | 'audio' | 'file'; | ||
declare type ListType = 'bulleted' | 'numbered' | 'todo'; | ||
declare type ListType = 'bulleted' | 'numbered' | 'todo' | 'toggle'; | ||
declare type ParagraphType = | ||
@@ -99,0 +102,0 @@ | 'text' |
{ | ||
"name": "@blocksuite/global", | ||
"version": "0.5.0-20230302205056-4385b7a", | ||
"version": "0.5.0-20230303192351-13b0dd7", | ||
"types": "./index.d.ts", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -7,3 +7,3 @@ import type { BaseBlockModel } from '@blocksuite/store'; | ||
export { DisposableGroup, flattenDisposable } from './utils/disposable.js'; | ||
export { Signal } from './utils/signal.js'; | ||
export { Slot } from './utils/slot.js'; | ||
export { caretRangeFromPoint, isFirefox, isWeb } from './utils/web.js'; | ||
@@ -121,2 +121,3 @@ export const SYS_KEYS = new Set(['id', 'flavour', 'children']); | ||
export const getDefaultPlaygroundURL = (isE2E: boolean): URL => | ||
new URL(`http://localhost:${isE2E ? 4173 : 5173}/`); | ||
new URL(`http://localhost:5173/`); | ||
// new URL(`http://localhost:${isE2E ? 4173 : 5173}/`); |
@@ -45,6 +45,24 @@ export const isWeb = typeof window !== 'undefined'; | ||
} | ||
const range = document.caretRangeFromPoint(clientX, clientY); | ||
if (!range) { | ||
return null; | ||
} | ||
// See https://github.com/toeverything/blocksuite/issues/1382 | ||
const rangeRects = range?.getClientRects(); | ||
if ( | ||
rangeRects && | ||
rangeRects.length === 2 && | ||
range.startOffset === range.endOffset && | ||
clientY < rangeRects[0].y + rangeRects[0].height | ||
) { | ||
const deltaX = (rangeRects[0].x | 0) - (rangeRects[1].x | 0); | ||
if (deltaX > 0) { | ||
range.setStart(range.startContainer, range.startOffset - 1); | ||
range.setEnd(range.endContainer, range.endOffset - 1); | ||
} | ||
} | ||
// This is a workaround | ||
@@ -51,0 +69,0 @@ // Sometimes the point be covered by the format bar, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
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 too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
416051
4472