@univerjs/sheets-ui v0.5.4


Interface: ISheetClipboardHook

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:84

ClipboardHook could:

  1. Before copy/cut/paste, decide whether to execute the command and prepare caches if necessary.
  2. When copying, decide what content could be written into clipboard.
  3. When pasting, get access to the clipboard content and append mutations to the paste command.

Properties

PropertyTypeDefined in
idstringsubmodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:85
isDefaultHook?booleansubmodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:86
priority?numbersubmodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:88
specialPasteInfo?ISpecialPasteInfosubmodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:87

Methods

getFilteredOutRows()?

optional getFilteredOutRows(range): number[]

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:182

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

ParameterType
rangeIRange

Returns

number[]


onAfterCopy()?

optional onAfterCopy(): void

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:124

Would be called after copy content has been written into clipboard. Features could do some cleaning up jobs here.

Returns

void


onAfterPaste()?

optional onAfterPaste(success): void

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:176

Parameters

ParameterType
successboolean

Returns

void


onBeforeCopy()?

optional onBeforeCopy(
   unitId, 
   subUnitId, 
   range): void

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:94

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

ParameterType
unitIdstring
subUnitIdstring
rangeIRange

Returns

void


onBeforePaste()?

optional onBeforePaste(pasteTo): boolean

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:137

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

ParameterType
pasteToISheetDiscreteRangeLocation

Returns

boolean

if it block copying it should return false


onCopyCellContent()?

optional onCopyCellContent(row, col): string

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:101

Parameters

ParameterType
rownumber
colnumber

Returns

string

content


onCopyCellStyle()?

optional onCopyCellStyle(
   row, 
   col, 
   rowSpan?, 
   colSpan?): null | IClipboardPropertyItem

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:109

Properties that would be appended to the td element.

Parameters

ParameterTypeDescription
rownumberrow of the the copied cell
colnumbercol of the the copied cell
rowSpan?number-
colSpan?number-

Returns

null | IClipboardPropertyItem

Deprecated

should be merged with onCopyCellContent to onCopyCell


onCopyColumn()?

optional onCopyColumn(col): null | IClipboardPropertyItem

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:119

Properties that would be appended to the col element.

Parameters

ParameterTypeDescription
colnumbereach col of the copied range

Returns

null | IClipboardPropertyItem


onCopyRow()?

optional onCopyRow(row): null | IClipboardPropertyItem

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:114

Properties that would be appended to the tr element.

Parameters

ParameterTypeDescription
rownumbereach row of the the copied range

Returns

null | IClipboardPropertyItem


onPasteCells()?

optional onPasteCells(
   pasteFrom, 
   pasteTo, 
   data, 
   payload): {
  redos: IMutationInfo[];
  undos: IMutationInfo[];
}

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:143

Parameters

ParameterType
pasteFromnull | ISheetDiscreteRangeLocation
pasteToISheetDiscreteRangeLocation
dataObjectMatrix<ICellDataWithSpanInfo>
payloadICopyPastePayload

Returns

{
  redos: IMutationInfo[];
  undos: IMutationInfo[];
}
NameTypeDefined in
redosIMutationInfo[]submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:150
undosIMutationInfo[]submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:149

onPasteColumns()?

optional onPasteColumns(
   pasteTo, 
   colProperties, 
   payload): {
  redos: IMutationInfo[];
  undos: IMutationInfo[];
}

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:160

Parameters

ParameterType
pasteToISheetDiscreteRangeLocation
colPropertiesIClipboardPropertyItem[]
payloadICopyPastePayload

Returns

{
  redos: IMutationInfo[];
  undos: IMutationInfo[];
}
NameTypeDefined in
redosIMutationInfo[]submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:166
undosIMutationInfo[]submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:165

onPastePlainText()?

optional onPastePlainText(
   pasteTo, 
   text, 
   payload): {
  redos: IMutationInfo[];
  undos: IMutationInfo[];
}

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:168

Parameters

ParameterType
pasteToISheetDiscreteRangeLocation
textstring
payloadICopyPastePayload

Returns

{
  redos: IMutationInfo[];
  undos: IMutationInfo[];
}
NameTypeDefined in
redosIMutationInfo[]submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:174
undosIMutationInfo[]submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:173

onPasteRows()?

optional onPasteRows(
   pasteTo, 
   rowProperties, 
   payload): {
  redos: IMutationInfo[];
  undos: IMutationInfo[];
}

Defined in: submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:152

Parameters

ParameterType
pasteToISheetDiscreteRangeLocation
rowPropertiesIClipboardPropertyItem[]
payloadICopyPastePayload

Returns

{
  redos: IMutationInfo[];
  undos: IMutationInfo[];
}
NameTypeDefined in
redosIMutationInfo[]submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:158
undosIMutationInfo[]submodules/univer/packages/sheets-ui/src/services/clipboard/type.ts:157