@blocksuite/virgo
Advanced tools
Comparing version 0.4.0-20230216093909-90a4996 to 0.4.0-20230216201306-ed1c8f8
@@ -8,5 +8,4 @@ import { LitElement } from 'lit'; | ||
underline: z.ZodOptional<z.ZodBoolean>; | ||
strikethrough: z.ZodOptional<z.ZodBoolean>; | ||
inlineCode: z.ZodOptional<z.ZodBoolean>; | ||
color: z.ZodOptional<z.ZodString>; | ||
strike: z.ZodOptional<z.ZodBoolean>; | ||
code: z.ZodOptional<z.ZodBoolean>; | ||
link: z.ZodOptional<z.ZodString>; | ||
@@ -17,5 +16,4 @@ }, "strip", z.ZodTypeAny, { | ||
underline?: boolean | undefined; | ||
strikethrough?: boolean | undefined; | ||
inlineCode?: boolean | undefined; | ||
color?: string | undefined; | ||
strike?: boolean | undefined; | ||
code?: boolean | undefined; | ||
link?: string | undefined; | ||
@@ -26,5 +24,4 @@ }, { | ||
underline?: boolean | undefined; | ||
strikethrough?: boolean | undefined; | ||
inlineCode?: boolean | undefined; | ||
color?: string | undefined; | ||
strike?: boolean | undefined; | ||
code?: boolean | undefined; | ||
link?: string | undefined; | ||
@@ -31,0 +28,0 @@ }>; |
@@ -17,5 +17,4 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
underline: z.boolean().optional(), | ||
strikethrough: z.boolean().optional(), | ||
inlineCode: z.boolean().optional(), | ||
color: z.string().optional(), | ||
strike: z.boolean().optional(), | ||
code: z.boolean().optional(), | ||
link: z.string().optional(), | ||
@@ -28,7 +27,7 @@ }); | ||
} | ||
if (props.strikethrough) { | ||
if (props.strike) { | ||
textDecorations += ' line-through'; | ||
} | ||
let inlineCodeStyle = {}; | ||
if (props.inlineCode) { | ||
if (props.code) { | ||
inlineCodeStyle = { | ||
@@ -35,0 +34,0 @@ 'font-family': '"SFMono-Regular", Menlo, Consolas, "PT Mono", "Liberation Mono", Courier, monospace', |
@@ -85,2 +85,3 @@ import { Signal } from '@blocksuite/global/utils'; | ||
private _onSelectionChange; | ||
private _onPaste; | ||
private _onUpdateVRange; | ||
@@ -87,0 +88,0 @@ private _transact; |
@@ -46,2 +46,18 @@ import { assertExists, Signal } from '@blocksuite/global/utils'; | ||
}; | ||
this._onPaste = (event) => { | ||
const data = event.clipboardData?.getData('text/plain'); | ||
if (data) { | ||
const vRange = this._vRange; | ||
if (vRange) { | ||
this.insertText(vRange, data); | ||
this.signals.updateVRange.emit([ | ||
{ | ||
index: vRange.index + data.length, | ||
length: 0, | ||
}, | ||
'input', | ||
]); | ||
} | ||
} | ||
}; | ||
this._onUpdateVRange = ([newRangStatic, origin]) => { | ||
@@ -107,2 +123,5 @@ this._vRange = newRangStatic; | ||
}); | ||
this._rootElement.addEventListener('paste', this._onPaste, { | ||
signal: this._rootElementAbort.signal, | ||
}); | ||
} | ||
@@ -109,0 +128,0 @@ unmount() { |
{ | ||
"name": "@blocksuite/virgo", | ||
"version": "0.4.0-20230216093909-90a4996", | ||
"version": "0.4.0-20230216201306-ed1c8f8", | ||
"description": "A micro editor.", | ||
@@ -26,3 +26,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@blocksuite/global": "0.4.0-20230216093909-90a4996", | ||
"@blocksuite/global": "0.4.0-20230216201306-ed1c8f8", | ||
"zod": "^3.20.6" | ||
@@ -29,0 +29,0 @@ }, |
@@ -14,5 +14,4 @@ import { html, LitElement } from 'lit'; | ||
underline: z.boolean().optional(), | ||
strikethrough: z.boolean().optional(), | ||
inlineCode: z.boolean().optional(), | ||
color: z.string().optional(), | ||
strike: z.boolean().optional(), | ||
code: z.boolean().optional(), | ||
link: z.string().optional(), | ||
@@ -30,3 +29,3 @@ }); | ||
} | ||
if (props.strikethrough) { | ||
if (props.strike) { | ||
textDecorations += ' line-through'; | ||
@@ -36,3 +35,3 @@ } | ||
let inlineCodeStyle = {}; | ||
if (props.inlineCode) { | ||
if (props.code) { | ||
inlineCodeStyle = { | ||
@@ -39,0 +38,0 @@ 'font-family': |
@@ -117,2 +117,5 @@ import { assertExists, Signal } from '@blocksuite/global/utils'; | ||
}); | ||
this._rootElement.addEventListener('paste', this._onPaste, { | ||
signal: this._rootElementAbort.signal, | ||
}); | ||
} | ||
@@ -656,2 +659,19 @@ | ||
private _onPaste = (event: ClipboardEvent) => { | ||
const data = event.clipboardData?.getData('text/plain'); | ||
if (data) { | ||
const vRange = this._vRange; | ||
if (vRange) { | ||
this.insertText(vRange, data); | ||
this.signals.updateVRange.emit([ | ||
{ | ||
index: vRange.index + data.length, | ||
length: 0, | ||
}, | ||
'input', | ||
]); | ||
} | ||
} | ||
}; | ||
private _onUpdateVRange = ([newRangStatic, origin]: UpdateVRangeProp) => { | ||
@@ -658,0 +678,0 @@ this._vRange = newRangStatic; |
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
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
238762
3411
+ Added@blocksuite/global@0.4.0-20230216201306-ed1c8f8(transitive)
- Removed@blocksuite/global@0.4.0-20230216093909-90a4996(transitive)