@univerjs/sheets-ui v0.4.2 • Docs
Interface: ISheetClipboardHook
ClipboardHook
could:
- Before copy/cut/paste, decide whether to execute the command and prepare caches if necessary.
- When copying, decide what content could be written into clipboard.
- When pasting, get access to the clipboard content and append mutations to the paste command.
Properties
Property | Type | Defined in |
---|---|---|
id | string | packages/sheets-ui/src/services/clipboard/type.ts:84 (opens in a new tab) |
isDefaultHook? | boolean | packages/sheets-ui/src/services/clipboard/type.ts:85 (opens in a new tab) |
priority? | number | packages/sheets-ui/src/services/clipboard/type.ts:87 (opens in a new tab) |
specialPasteInfo? | ISpecialPasteInfo | packages/sheets-ui/src/services/clipboard/type.ts:86 (opens in a new tab) |
Methods
getFilteredOutRows()?
optional getFilteredOutRows(range): number[]
The callback would be called before the clipboard service decides what region need to be copied from or pasted to. It would jump over these filtered rows when copying or pasting.
Parameters
Parameter | Type |
---|---|
range | IRange |
Returns
number
[]
Defined in
packages/sheets-ui/src/services/clipboard/type.ts:181 (opens in a new tab)
onAfterCopy()?
optional onAfterCopy(): void
Would be called after copy content has been written into clipboard. Features could do some cleaning up jobs here.
Returns
void
Defined in
packages/sheets-ui/src/services/clipboard/type.ts:123 (opens in a new tab)
onAfterPaste()?
optional onAfterPaste(success): void
Parameters
Parameter | Type |
---|---|
success | boolean |
Returns
void
Defined in
packages/sheets-ui/src/services/clipboard/type.ts:175 (opens in a new tab)
onBeforeCopy()?
optional onBeforeCopy(
unitId,
subUnitId,
range): void
The callback would be called after the clipboard service has decided what region need to be copied. Features could use this hook to build copying cache or any other pre-copy jobs.
Parameters
Parameter | Type |
---|---|
unitId | string |
subUnitId | string |
range | IRange |
Returns
void
Defined in
packages/sheets-ui/src/services/clipboard/type.ts:93 (opens in a new tab)
onBeforePaste()?
optional onBeforePaste(pasteTo): boolean
The callback would be called after the clipboard service has decided what region need to be pasted. Features could use this hook to build copying cache or any other pre-copy jobs.
Parameters
Parameter | Type |
---|---|
pasteTo | ISheetDiscreteRangeLocation |
Returns
boolean
if it block copying it should return false
Defined in
packages/sheets-ui/src/services/clipboard/type.ts:136 (opens in a new tab)
onCopyCellContent()?
optional onCopyCellContent(row, col): string
Parameters
Parameter | Type |
---|---|
row | number |
col | number |
Returns
string
content
Defined in
packages/sheets-ui/src/services/clipboard/type.ts:100 (opens in a new tab)
onCopyCellStyle()?
optional onCopyCellStyle(
row,
col,
rowSpan?,
colSpan?): null | IClipboardPropertyItem
Properties that would be appended to the td element.
Parameters
Parameter | Type | Description |
---|---|---|
row | number | row of the the copied cell |
col | number | col of the the copied cell |
rowSpan ? | number | - |
colSpan ? | number | - |
Returns
null
| IClipboardPropertyItem
Deprecated
should be merged with onCopyCellContent
to onCopyCell
Defined in
packages/sheets-ui/src/services/clipboard/type.ts:108 (opens in a new tab)
onCopyColumn()?
optional onCopyColumn(col): null | IClipboardPropertyItem
Properties that would be appended to the col element.
Parameters
Parameter | Type | Description |
---|---|---|
col | number | each col of the copied range |
Returns
null
| IClipboardPropertyItem
Defined in
packages/sheets-ui/src/services/clipboard/type.ts:118 (opens in a new tab)
onCopyRow()?
optional onCopyRow(row): null | IClipboardPropertyItem
Properties that would be appended to the tr element.
Parameters
Parameter | Type | Description |
---|---|---|
row | number | each row of the the copied range |
Returns
null
| IClipboardPropertyItem
Defined in
packages/sheets-ui/src/services/clipboard/type.ts:113 (opens in a new tab)
onPasteCells()?
optional onPasteCells(
pasteFrom,
pasteTo,
data,
payload): {
redos: IMutationInfo<object>[];
undos: IMutationInfo<object>[];
}
Parameters
Parameter | Type |
---|---|
pasteFrom | null | ISheetDiscreteRangeLocation |
pasteTo | ISheetDiscreteRangeLocation |
data | ObjectMatrix <ICellDataWithSpanInfo > |
payload | ICopyPastePayload |
Returns
{
redos: IMutationInfo<object>[];
undos: IMutationInfo<object>[];
}
Name | Type | Defined in |
---|---|---|
redos | IMutationInfo <object >[] | packages/sheets-ui/src/services/clipboard/type.ts:149 (opens in a new tab) |
undos | IMutationInfo <object >[] | packages/sheets-ui/src/services/clipboard/type.ts:148 (opens in a new tab) |
Defined in
packages/sheets-ui/src/services/clipboard/type.ts:142 (opens in a new tab)
onPasteColumns()?
optional onPasteColumns(
pasteTo,
colProperties,
payload): {
redos: IMutationInfo<object>[];
undos: IMutationInfo<object>[];
}
Parameters
Parameter | Type |
---|---|
pasteTo | ISheetDiscreteRangeLocation |
colProperties | IClipboardPropertyItem [] |
payload | ICopyPastePayload |
Returns
{
redos: IMutationInfo<object>[];
undos: IMutationInfo<object>[];
}
Name | Type | Defined in |
---|---|---|
redos | IMutationInfo <object >[] | packages/sheets-ui/src/services/clipboard/type.ts:165 (opens in a new tab) |
undos | IMutationInfo <object >[] | packages/sheets-ui/src/services/clipboard/type.ts:164 (opens in a new tab) |
Defined in
packages/sheets-ui/src/services/clipboard/type.ts:159 (opens in a new tab)
onPastePlainText()?
optional onPastePlainText(
pasteTo,
text,
payload): {
redos: IMutationInfo<object>[];
undos: IMutationInfo<object>[];
}
Parameters
Parameter | Type |
---|---|
pasteTo | ISheetDiscreteRangeLocation |
text | string |
payload | ICopyPastePayload |
Returns
{
redos: IMutationInfo<object>[];
undos: IMutationInfo<object>[];
}
Name | Type | Defined in |
---|---|---|
redos | IMutationInfo <object >[] | packages/sheets-ui/src/services/clipboard/type.ts:173 (opens in a new tab) |
undos | IMutationInfo <object >[] | packages/sheets-ui/src/services/clipboard/type.ts:172 (opens in a new tab) |
Defined in
packages/sheets-ui/src/services/clipboard/type.ts:167 (opens in a new tab)
onPasteRows()?
optional onPasteRows(
pasteTo,
rowProperties,
payload): {
redos: IMutationInfo<object>[];
undos: IMutationInfo<object>[];
}
Parameters
Parameter | Type |
---|---|
pasteTo | ISheetDiscreteRangeLocation |
rowProperties | IClipboardPropertyItem [] |
payload | ICopyPastePayload |
Returns
{
redos: IMutationInfo<object>[];
undos: IMutationInfo<object>[];
}
Name | Type | Defined in |
---|---|---|
redos | IMutationInfo <object >[] | packages/sheets-ui/src/services/clipboard/type.ts:157 (opens in a new tab) |
undos | IMutationInfo <object >[] | packages/sheets-ui/src/services/clipboard/type.ts:156 (opens in a new tab) |
Defined in
packages/sheets-ui/src/services/clipboard/type.ts:151 (opens in a new tab)