File tree 5 files changed +9
-105
lines changed
packages/pluggableWidgets/rich-text-web/src/utils/formats
5 files changed +9
-105
lines changed Original file line number Diff line number Diff line change 1
- // @ts -nocheck
2
1
import Quill from "quill" ;
2
+ import QuillClipboard from "quill/modules/clipboard" ;
3
3
import Delta from "quill-delta" ;
4
4
import logger from "quill/core/logger.js" ;
5
- import Module from "quill/core/module " ;
6
- import QuillClipboard from "quill/modules/clipboard " ;
5
+ import type { Range } from "quill" ;
6
+ import type { Props } from "../types " ;
7
7
import { TableCellBlock , TableTemporary } from "../formats/table" ;
8
- import type { Props , Range } from "../types" ;
9
8
10
- const Clipboard = QuillClipboard as typeof Module ;
9
+ const Clipboard = QuillClipboard ;
11
10
const debug = logger ( "quill:clipboard" ) ;
12
11
13
12
class TableClipboard extends Clipboard {
14
- convert : (
15
- {
16
- html,
17
- text
18
- } : {
19
- html ?: string ;
20
- text ?: string ;
21
- } ,
22
- formats ?: Record < string , unknown >
23
- ) => Delta ;
24
-
25
13
onPaste ( range : Range , { text, html } : { text ?: string ; html ?: string } ) {
26
14
const formats = this . quill . getFormat ( range . index ) as Props ;
27
15
const pastedDelta = this . getTableDelta ( { text, html } , formats ) ;
Original file line number Diff line number Diff line change @@ -18,10 +18,7 @@ const Toolbar = QuillToolbar as typeof Module;
18
18
type Handler = ( this : TableToolbar , value : any ) => void ;
19
19
20
20
class TableToolbar extends Toolbar {
21
- handlers : Record < string , Handler > ;
22
- controls : [ string , HTMLElement ] [ ] ;
23
- update : ( range : Range | null ) => void ;
24
- container ?: HTMLElement | null ;
21
+ handlers : Record < string , Handler > = { } ;
25
22
26
23
attach ( input : HTMLElement ) {
27
24
let format = Array . from ( input . classList ) . find ( className => {
Original file line number Diff line number Diff line change @@ -206,7 +206,8 @@ class Table extends Module {
206
206
if ( ! toolbarTable ) return ;
207
207
Quill . register ( { "formats/table-better" : ToolbarTable } , true ) ;
208
208
const toolbar = this . quill . getModule ( "toolbar" ) as TableToolbar ;
209
- const button = toolbar . container . querySelector ( "button.ql-table-better" ) ;
209
+ const container = document . querySelector ( toolbar . options . container ) ;
210
+ const button = container . querySelector ( "button.ql-table-better" ) ;
210
211
if ( ! button || ! this . tableSelect . root ) return ;
211
212
button . appendChild ( this . tableSelect . root ) ;
212
213
button . addEventListener ( "click" , ( e : MouseEvent ) => {
Original file line number Diff line number Diff line change @@ -349,9 +349,8 @@ class CellSelection {
349
349
350
350
initWhiteList ( ) {
351
351
const toolbar = this . quill . getModule ( "toolbar" ) ;
352
- // @ts -expect-error
353
- Array . from ( toolbar . container . querySelectorAll ( "button, select" ) ) . forEach ( input => {
354
- // @ts -ignore
352
+ const container = document . querySelector ( toolbar . options . container ) ;
353
+ container . querySelectorAll ( "button, select" ) . forEach ( input => {
355
354
this . attach ( input ) ;
356
355
} ) ;
357
356
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments