@acrolinx/sidebar-sdk 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +303 -23
- package/dist/index.js +390 -296
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { AcrolinxPlugin as AcrolinxPlugin_2 } from '@acrolinx/sidebar-interface';
|
|
2
|
+
import * as acrolinxSidebarInterfaces from '@acrolinx/sidebar-interface';
|
|
2
3
|
import { AcrolinxStorage } from '@acrolinx/sidebar-interface';
|
|
3
4
|
import { Check } from '@acrolinx/sidebar-interface';
|
|
4
5
|
import { CheckedDocumentPart } from '@acrolinx/sidebar-interface';
|
|
5
6
|
import { CheckInformationKeyValuePair } from '@acrolinx/sidebar-interface';
|
|
6
7
|
import { CheckResult } from '@acrolinx/sidebar-interface';
|
|
7
8
|
import { default as default_2 } from '@ckeditor/ckeditor5-build-inline';
|
|
9
|
+
import { Diff } from 'diff-match-patch';
|
|
8
10
|
import { DocumentSelection } from '@acrolinx/sidebar-interface';
|
|
9
11
|
import { Editor } from 'tinymce';
|
|
10
12
|
import { EditorFromTextArea } from 'codemirror';
|
|
@@ -83,6 +85,8 @@ export declare interface AcrolinxPluginConfig extends InitParameters {
|
|
|
83
85
|
log?: (logEntry: LogEntry) => void;
|
|
84
86
|
}
|
|
85
87
|
|
|
88
|
+
declare type AcrolinxSidebar = acrolinxSidebarInterfaces.AcrolinxSidebar;
|
|
89
|
+
|
|
86
90
|
export declare interface AcrolinxSidebarIntegration {
|
|
87
91
|
AcrolinxPlugin: typeof AcrolinxPlugin;
|
|
88
92
|
autoBindFloatingSidebar: typeof autoBindFloatingSidebar;
|
|
@@ -92,6 +96,7 @@ export declare interface AcrolinxSidebarIntegration {
|
|
|
92
96
|
createPluginMessageAdapter: typeof createPluginMessageAdapter;
|
|
93
97
|
loadSidebarCode: typeof loadSidebarCode;
|
|
94
98
|
getSelectionHtmlRanges: typeof getSelectionHtmlRanges;
|
|
99
|
+
extractTextDomMapping: typeof extractTextDomMapping;
|
|
95
100
|
adapter: {
|
|
96
101
|
AbstractRichtextEditorAdapter: typeof AbstractRichtextEditorAdapter;
|
|
97
102
|
AutoBindAdapter: typeof AutoBindAdapter;
|
|
@@ -107,14 +112,17 @@ export declare interface AcrolinxSidebarIntegration {
|
|
|
107
112
|
AsyncMultiEditorAdapter: typeof AsyncMultiEditorAdapter;
|
|
108
113
|
TinyMCEAdapter: typeof TinyMCEAdapter;
|
|
109
114
|
XeditorAdapter: typeof XeditorAdapter;
|
|
115
|
+
QuipAdapter: typeof QuipAdapter;
|
|
116
|
+
SynchronizeAsyncAdapter: typeof SynchronizeAsyncAdapter;
|
|
110
117
|
};
|
|
111
118
|
lookup: {
|
|
112
119
|
lookupMatches: typeof lookupMatches;
|
|
113
120
|
};
|
|
114
|
-
extractTextDomMapping: typeof extractTextDomMapping;
|
|
115
121
|
}
|
|
116
122
|
|
|
117
|
-
declare type
|
|
123
|
+
declare type AcrolinxSidebarPlugin = acrolinxSidebarInterfaces.AcrolinxPlugin;
|
|
124
|
+
|
|
125
|
+
export declare type AdapterConf = HasEditorID | HasElement;
|
|
118
126
|
|
|
119
127
|
export declare interface AdapterInterface extends CommonAdapterInterface {
|
|
120
128
|
selectRanges(checkId: string, matches: Match[]): void;
|
|
@@ -123,11 +131,15 @@ export declare interface AdapterInterface extends CommonAdapterInterface {
|
|
|
123
131
|
|
|
124
132
|
declare type AddSingleAdapterOptions = WrapperConfOptions;
|
|
125
133
|
|
|
126
|
-
declare interface AlignedMatch<T extends Match> {
|
|
134
|
+
export declare interface AlignedMatch<T extends Match> {
|
|
127
135
|
originalMatch: T;
|
|
128
136
|
range: [number, number];
|
|
129
137
|
}
|
|
130
138
|
|
|
139
|
+
export declare function assertElementIsDisplayed(element: Element): void;
|
|
140
|
+
|
|
141
|
+
export declare function assign<T, U>(obj: T, update: U): T & U;
|
|
142
|
+
|
|
131
143
|
export declare interface AsyncAdapterInterface extends CommonAdapterInterface {
|
|
132
144
|
readonly isAsync: true;
|
|
133
145
|
readonly requiresSynchronization: boolean;
|
|
@@ -163,7 +175,7 @@ export declare class AsyncMultiEditorAdapter extends MultiEditorAdapter implemen
|
|
|
163
175
|
replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): Promise<void>;
|
|
164
176
|
}
|
|
165
177
|
|
|
166
|
-
declare interface AsyncStorage {
|
|
178
|
+
export declare interface AsyncStorage {
|
|
167
179
|
get<T>(key: string): Promise<T | null>;
|
|
168
180
|
set<T>(key: string, value: T): Promise<void>;
|
|
169
181
|
}
|
|
@@ -172,6 +184,10 @@ declare type AttributeMap = {
|
|
|
172
184
|
[key: string]: any;
|
|
173
185
|
};
|
|
174
186
|
|
|
187
|
+
export declare const AUTO_SELF_CLOSING_LINE_TAGS: Readonly<{
|
|
188
|
+
[key: string]: boolean;
|
|
189
|
+
}>;
|
|
190
|
+
|
|
175
191
|
export declare class AutoBindAdapter implements AdapterInterface {
|
|
176
192
|
private conf;
|
|
177
193
|
private multiAdapter;
|
|
@@ -185,7 +201,7 @@ export declare class AutoBindAdapter implements AdapterInterface {
|
|
|
185
201
|
replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): void;
|
|
186
202
|
}
|
|
187
203
|
|
|
188
|
-
declare interface AutobindConfig extends CommonAdapterConf {
|
|
204
|
+
export declare interface AutobindConfig extends CommonAdapterConf {
|
|
189
205
|
enableQuipAdapter?: boolean;
|
|
190
206
|
}
|
|
191
207
|
|
|
@@ -193,11 +209,11 @@ export declare function autoBindFloatingSidebar(basicConf: AutoBindFloatingSideb
|
|
|
193
209
|
|
|
194
210
|
export declare function autoBindFloatingSidebarAsync(basicConf: AutoBindFloatingSidebarConfig): Promise<FloatingSidebar>;
|
|
195
211
|
|
|
196
|
-
declare interface AutoBindFloatingSidebarConfig extends AcrolinxPluginConfig, MultiEditorAdapterConfig, AutobindConfig {
|
|
212
|
+
export declare interface AutoBindFloatingSidebarConfig extends AcrolinxPluginConfig, MultiEditorAdapterConfig, AutobindConfig {
|
|
197
213
|
asyncStorage?: AsyncStorage;
|
|
198
214
|
}
|
|
199
215
|
|
|
200
|
-
declare interface AutobindWrapperAttributes {
|
|
216
|
+
export declare interface AutobindWrapperAttributes {
|
|
201
217
|
'original-id'?: string;
|
|
202
218
|
'original-class'?: string;
|
|
203
219
|
'original-name'?: string;
|
|
@@ -206,6 +222,10 @@ declare interface AutobindWrapperAttributes {
|
|
|
206
222
|
[key: string]: string | undefined;
|
|
207
223
|
}
|
|
208
224
|
|
|
225
|
+
export declare function bindAdaptersForCurrentPage(conf?: AutobindConfig): AdapterInterface[];
|
|
226
|
+
|
|
227
|
+
export declare const browser: DetectedBrowser;
|
|
228
|
+
|
|
209
229
|
declare interface CheckContentResult {
|
|
210
230
|
dom: HTMLElement;
|
|
211
231
|
text: string;
|
|
@@ -241,6 +261,15 @@ export declare class CKEditorAdapter extends AbstractRichtextEditorAdapter {
|
|
|
241
261
|
isInWysiwygMode(): boolean;
|
|
242
262
|
}
|
|
243
263
|
|
|
264
|
+
export declare const CLIENT_COMPONENT_MAIN_FALLBACK: {
|
|
265
|
+
id: string;
|
|
266
|
+
name: string;
|
|
267
|
+
version: string;
|
|
268
|
+
category: string;
|
|
269
|
+
}[];
|
|
270
|
+
|
|
271
|
+
export declare const CLOSE_ICON_CLASS = "acrolinxFloatingSidebarCloseIcon";
|
|
272
|
+
|
|
244
273
|
export declare class CodeMirror6Adapter implements AdapterInterface {
|
|
245
274
|
private config;
|
|
246
275
|
private currentContentChecking?;
|
|
@@ -299,7 +328,7 @@ declare type CodeMirrorAdapterConf = {
|
|
|
299
328
|
format?: string;
|
|
300
329
|
};
|
|
301
330
|
|
|
302
|
-
declare interface CommonAdapterConf {
|
|
331
|
+
export declare interface CommonAdapterConf {
|
|
303
332
|
scrollOffsetY?: number;
|
|
304
333
|
disableInputEventSimulation?: boolean;
|
|
305
334
|
}
|
|
@@ -314,6 +343,15 @@ export declare interface CommonAdapterInterface {
|
|
|
314
343
|
onInitFinished?(result: InitResult): void;
|
|
315
344
|
}
|
|
316
345
|
|
|
346
|
+
export declare function concatTextMappings(textMappings: TextDomMapping[]): TextDomMapping;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Connects to a sidebar iframe that is on a different domain and uses the plugin message adapter.
|
|
350
|
+
*/
|
|
351
|
+
export declare function connectAcrolinxPluginToMessages(acrolinxPlugin: InternalAcrolinxSidebarPluginInterface, sidebarWindowIframe: HTMLIFrameElement): void;
|
|
352
|
+
|
|
353
|
+
export declare function containsText(s: string): boolean;
|
|
354
|
+
|
|
317
355
|
export declare class ContentEditableAdapter extends AbstractRichtextEditorAdapter {
|
|
318
356
|
element: HTMLElement;
|
|
319
357
|
constructor(conf: AdapterConf);
|
|
@@ -323,57 +361,113 @@ export declare class ContentEditableAdapter extends AbstractRichtextEditorAdapte
|
|
|
323
361
|
getEditorDocument(): Document;
|
|
324
362
|
}
|
|
325
363
|
|
|
326
|
-
declare type ContentExtractionResult = SuccessfulContentExtractionResult | HasError;
|
|
364
|
+
export declare type ContentExtractionResult = SuccessfulContentExtractionResult | HasError;
|
|
365
|
+
|
|
366
|
+
export declare function createOffsetMappingArray(diffs: Diff[]): OffSetAlign[];
|
|
327
367
|
|
|
328
368
|
/**
|
|
329
369
|
* Used inside of a sidebar iframe on a different domain.
|
|
330
370
|
*/
|
|
331
371
|
export declare function createPluginMessageAdapter(win?: Window & typeof globalThis): AcrolinxPlugin_2;
|
|
332
372
|
|
|
333
|
-
declare
|
|
373
|
+
export declare function deepCloneWithHTMLElement<T>(obj: T): T;
|
|
374
|
+
|
|
375
|
+
export declare function deepFreezed<T>(o: T): T;
|
|
376
|
+
|
|
377
|
+
export declare const DEFAULT_POS: Position;
|
|
378
|
+
|
|
379
|
+
export declare class Deferred<T> {
|
|
380
|
+
resolve: (x: T) => void;
|
|
381
|
+
reject: (x: T) => void;
|
|
382
|
+
promise: Promise<T>;
|
|
383
|
+
constructor();
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export declare interface DetectedBrowser {
|
|
387
|
+
name: string;
|
|
388
|
+
version: string;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export declare interface DomPosition {
|
|
334
392
|
node: Node;
|
|
335
393
|
offset: number;
|
|
336
394
|
}
|
|
337
395
|
|
|
396
|
+
export declare function domPosition(node: Node, offset: number): DomPosition;
|
|
397
|
+
|
|
398
|
+
export declare const EDITABLE_ELEMENTS_SELECTOR: string;
|
|
399
|
+
|
|
338
400
|
declare type ElementHtmlGetter = (el: HTMLElement) => string;
|
|
339
401
|
|
|
340
|
-
declare
|
|
402
|
+
export declare function enableLogging(): void;
|
|
403
|
+
|
|
404
|
+
export declare function escapeHtmlCharacters(text: string): EscapeHtmlCharactersResult;
|
|
405
|
+
|
|
406
|
+
export declare interface EscapeHtmlCharactersResult {
|
|
341
407
|
escapedText: string;
|
|
342
408
|
backwardAlignment: OffSetAlign[];
|
|
343
409
|
}
|
|
344
410
|
|
|
345
|
-
declare interface ExtractContentForCheckOpts {
|
|
411
|
+
export declare interface ExtractContentForCheckOpts {
|
|
346
412
|
checkSelection?: boolean;
|
|
347
413
|
}
|
|
348
414
|
|
|
415
|
+
export declare function extractText(s: string): [string, OffSetAlign[]];
|
|
416
|
+
|
|
349
417
|
export declare function extractTextDomMapping(node: Node): TextDomMapping;
|
|
350
418
|
|
|
351
|
-
declare
|
|
419
|
+
export declare function findDisplacement(offsetMappingArray: OffSetAlign[], originalIndex: number): number;
|
|
420
|
+
|
|
421
|
+
export declare function findNewIndex(offsetMappingArray: OffSetAlign[], originalIndex: number): number;
|
|
422
|
+
|
|
423
|
+
export declare interface FloatingSidebar {
|
|
352
424
|
toggleVisibility(): void;
|
|
353
425
|
remove(): void;
|
|
354
426
|
}
|
|
355
427
|
|
|
356
|
-
declare interface FloatingSidebarConfig {
|
|
428
|
+
export declare interface FloatingSidebarConfig {
|
|
357
429
|
asyncStorage: AsyncStorage;
|
|
358
430
|
sidebarContainerId?: string;
|
|
359
431
|
}
|
|
360
432
|
|
|
433
|
+
export declare const FOOTER = "acrolinxFloatingSidebarFooter";
|
|
434
|
+
|
|
435
|
+
export declare const FOOTER_HEIGHT = 34;
|
|
436
|
+
|
|
361
437
|
declare type Format = 'TEXT' | 'MARKDOWN';
|
|
362
438
|
|
|
439
|
+
export declare function getAutobindWrapperAttributes(element: Element): AutobindWrapperAttributes;
|
|
440
|
+
|
|
441
|
+
export declare function getCompleteFlagLength<T extends Match>(matches: AlignedMatch<T>[]): number;
|
|
442
|
+
|
|
443
|
+
export declare function getEditableElements(doc?: Document | ShadowRoot | HTMLElement): Element[];
|
|
444
|
+
|
|
445
|
+
export declare function getElementFromAdapterConf(conf: AdapterConf): HTMLElement;
|
|
446
|
+
|
|
447
|
+
export declare function getEndDomPos(endIndex: number, domPositions: DomPosition[]): DomPosition;
|
|
448
|
+
|
|
363
449
|
export declare function getSelectionHtmlRanges(editorElement: HTMLElement, getElementHtml?: ElementHtmlGetter): [number, number][];
|
|
364
450
|
|
|
365
|
-
declare
|
|
451
|
+
export declare function grepAttributeValues(html: string, attribute: string): string[];
|
|
452
|
+
|
|
453
|
+
export declare interface HasEditorID extends CommonAdapterConf {
|
|
366
454
|
editorId: string;
|
|
367
455
|
}
|
|
368
456
|
|
|
369
|
-
declare
|
|
457
|
+
export declare function hasEditorID(a: AdapterConf): a is HasEditorID;
|
|
458
|
+
|
|
459
|
+
export declare interface HasElement extends CommonAdapterConf {
|
|
370
460
|
element: HTMLElement;
|
|
371
461
|
}
|
|
372
462
|
|
|
373
|
-
declare
|
|
463
|
+
export declare function hasElement(a: AdapterConf): a is HasElement;
|
|
464
|
+
|
|
465
|
+
export declare interface HasError {
|
|
374
466
|
error: any;
|
|
375
467
|
}
|
|
376
468
|
|
|
469
|
+
export declare function hasError(a: ContentExtractionResult): a is HasError;
|
|
470
|
+
|
|
377
471
|
export declare function initFloatingSidebar(config: FloatingSidebarConfig): FloatingSidebar;
|
|
378
472
|
|
|
379
473
|
export declare class InputAdapter implements AdapterInterface {
|
|
@@ -401,7 +495,50 @@ declare type InputAdapterConf = AdapterConf & {
|
|
|
401
495
|
format?: Format;
|
|
402
496
|
};
|
|
403
497
|
|
|
404
|
-
declare type InputFormat = 'HTML' | 'TEXT';
|
|
498
|
+
export declare type InputFormat = 'HTML' | 'TEXT';
|
|
499
|
+
|
|
500
|
+
declare interface InternalAcrolinxSidebarPluginInterface extends AcrolinxSidebarPlugin {
|
|
501
|
+
requestInit(acrolinxSidebarArg?: AcrolinxSidebar): void;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export declare function internalFetch(url: string): Promise<string>;
|
|
505
|
+
|
|
506
|
+
export declare const IS_DRAGGED_CLASS = "acrolinxFloatingSidebarIsDragged";
|
|
507
|
+
|
|
508
|
+
export declare const IS_RESIZING_CLASS = "acrolinxFloatingSidebarIsResizing";
|
|
509
|
+
|
|
510
|
+
export declare function isAsyncAdapterInterface(a: AdapterInterface | AsyncAdapterInterface): a is AsyncAdapterInterface;
|
|
511
|
+
|
|
512
|
+
export declare function isChrome(): boolean;
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* We don't want to destroy markup/markdown.
|
|
516
|
+
*/
|
|
517
|
+
export declare function isDangerousToReplace(checkedDocumentContent: string, originalMatch: Match): boolean;
|
|
518
|
+
|
|
519
|
+
export declare function isDisplayed(element: Element): boolean;
|
|
520
|
+
|
|
521
|
+
export declare function isFromSameOrigin(url: string): boolean;
|
|
522
|
+
|
|
523
|
+
export declare function isIFrame(el: Element): el is HTMLIFrameElement;
|
|
524
|
+
|
|
525
|
+
export declare function isProbablyUndesiredField(el: Element): boolean;
|
|
526
|
+
|
|
527
|
+
export declare function isPromise<T>(result: T | Promise<T>): result is Promise<T>;
|
|
528
|
+
|
|
529
|
+
export declare function isSuccessfulContentExtractionResult(a: ContentExtractionResult): a is SuccessfulContentExtractionResult;
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Exported only for testing.
|
|
533
|
+
*/
|
|
534
|
+
export declare function keepVisible({ left, top, height }: Position, windowWidth?: number, windowHeight?: number): Position;
|
|
535
|
+
|
|
536
|
+
export declare function loadFromLocalStorage<T>(key: string): T | null;
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Exported only for testing.
|
|
540
|
+
*/
|
|
541
|
+
export declare function loadInitialPos(asyncStorage: AsyncStorage): Promise<Position>;
|
|
405
542
|
|
|
406
543
|
/**
|
|
407
544
|
* Loads the Styles and Scripts of the sidebar into the current window.
|
|
@@ -411,6 +548,10 @@ declare type InputFormat = 'HTML' | 'TEXT';
|
|
|
411
548
|
*/
|
|
412
549
|
export declare function loadSidebarCode(sidebarBaseUrl: string): Promise<void>;
|
|
413
550
|
|
|
551
|
+
export declare function log(message: any, ...args: any[]): void;
|
|
552
|
+
|
|
553
|
+
export declare function logTime(text: string, f: Function): any;
|
|
554
|
+
|
|
414
555
|
/**
|
|
415
556
|
* @param {string} checkedDocument Text or HTML of the document (at check time)
|
|
416
557
|
* @param {string} currentDocument Text or HTML of the current document
|
|
@@ -447,18 +588,68 @@ export declare class MultiEditorAdapter implements AdapterInterface {
|
|
|
447
588
|
replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): void;
|
|
448
589
|
}
|
|
449
590
|
|
|
450
|
-
declare interface MultiEditorAdapterConfig {
|
|
591
|
+
export declare interface MultiEditorAdapterConfig {
|
|
451
592
|
aggregateFormat?: 'AUTO' | 'HTML';
|
|
452
593
|
documentHeader?: string;
|
|
453
594
|
rootElement?: WrapperConfOptions;
|
|
454
595
|
beforeCheck?: (multiAdapter: MultiEditorAdapter) => void;
|
|
455
596
|
}
|
|
456
597
|
|
|
457
|
-
declare
|
|
598
|
+
export declare const NEW_LINE_TAGS: Readonly<{
|
|
599
|
+
[key: string]: boolean;
|
|
600
|
+
}>;
|
|
601
|
+
|
|
602
|
+
export declare interface OffSetAlign {
|
|
458
603
|
oldPosition: number;
|
|
459
604
|
diffOffset: number;
|
|
460
605
|
}
|
|
461
606
|
|
|
607
|
+
export declare function parseUrl(href: string): {
|
|
608
|
+
protocol: string;
|
|
609
|
+
host: string;
|
|
610
|
+
hostname: string;
|
|
611
|
+
port: string;
|
|
612
|
+
pathname: string;
|
|
613
|
+
hash: string;
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
export declare interface Position extends PositionUpdate {
|
|
617
|
+
top: number;
|
|
618
|
+
left: number;
|
|
619
|
+
height: number;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
export declare const POSITION_KEY = "acrolinx.plugins.floatingSidebar.position";
|
|
623
|
+
|
|
624
|
+
export declare interface PositionUpdate {
|
|
625
|
+
top?: number;
|
|
626
|
+
left?: number;
|
|
627
|
+
height?: number;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
export declare type PromiseProvider<T> = () => PromiseLike<T>;
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Just a proof of concept.
|
|
634
|
+
*/
|
|
635
|
+
export declare class QuipAdapter extends AbstractRichtextEditorAdapter {
|
|
636
|
+
element: HTMLElement;
|
|
637
|
+
constructor(conf: AdapterConf);
|
|
638
|
+
getEditorElement(): HTMLElement;
|
|
639
|
+
getContent(): string;
|
|
640
|
+
protected getSelection(): DocumentSelection;
|
|
641
|
+
getEditorDocument(): Document;
|
|
642
|
+
replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): Promise<void>;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export declare function rangeContent(content: string, m: {
|
|
646
|
+
range: [number, number];
|
|
647
|
+
}): string;
|
|
648
|
+
|
|
649
|
+
export declare function rebaseRelativeUrl(url: string, sidebarBaseUrl: string): string;
|
|
650
|
+
|
|
651
|
+
export declare function rebaseRelativeUrls(sidebarHtml: string, sidebarBaseUrl: string): string;
|
|
652
|
+
|
|
462
653
|
declare interface RegisteredAdapter {
|
|
463
654
|
id: string;
|
|
464
655
|
adapter: AdapterInterface | AsyncAdapterInterface;
|
|
@@ -472,6 +663,57 @@ declare interface RemappedMatches<T extends Match> {
|
|
|
472
663
|
adapter: AdapterInterface;
|
|
473
664
|
}
|
|
474
665
|
|
|
666
|
+
export declare function removeNode(node: Node): void;
|
|
667
|
+
|
|
668
|
+
export declare const RESIZE_ICON_CLASS = "acrolinxFloatingSidebarResizeIcon";
|
|
669
|
+
|
|
670
|
+
export declare function saveToLocalStorage<T>(key: string, object: T): void;
|
|
671
|
+
|
|
672
|
+
export declare function scrollIntoView(targetEl: HTMLElement, windowTopOffset?: number, localTopOffset?: number): void;
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* @return indicates if it succeeded
|
|
676
|
+
*/
|
|
677
|
+
export declare function scrollIntoViewCenteredIfPossible(targetEl: HTMLElement): boolean;
|
|
678
|
+
|
|
679
|
+
export declare function scrollIntoViewCenteredWithFallback(targetEl: HTMLElement): void;
|
|
680
|
+
|
|
681
|
+
export declare let SIDEBAR_CONTAINER_ID: string;
|
|
682
|
+
|
|
683
|
+
export declare const SIDEBAR_DRAG_OVERLAY_ID = "acrolinxDragOverlay";
|
|
684
|
+
|
|
685
|
+
export declare const SIDEBAR_GLASS_PANE_ID = "acrolinxFloatingSidebarGlassPane";
|
|
686
|
+
|
|
687
|
+
export declare const SIDEBAR_ID = "acrolinxFloatingSidebar";
|
|
688
|
+
|
|
689
|
+
export declare const SIDEBAR_SDK_COMPONENT: {
|
|
690
|
+
id: string;
|
|
691
|
+
name: string;
|
|
692
|
+
version: string;
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
export declare class SidebarURLInvalidError extends Error {
|
|
696
|
+
message: string;
|
|
697
|
+
configuredSidebarURL: string;
|
|
698
|
+
htmlLoaded: string;
|
|
699
|
+
details: string;
|
|
700
|
+
constructor(message: string, configuredSidebarURL: string, htmlLoaded: string);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export declare function simulateInputEvent(props: SimulateInputEventProps): void;
|
|
704
|
+
|
|
705
|
+
export declare type SimulateInputEventProps = {
|
|
706
|
+
startNode: Node;
|
|
707
|
+
endNode: Node;
|
|
708
|
+
eventType: string;
|
|
709
|
+
startOffset: number;
|
|
710
|
+
endOffset: number;
|
|
711
|
+
replacement: string;
|
|
712
|
+
disableSimulation?: boolean;
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
export declare function sortedIndexBy<T>(array: T[], value: T, iteratee: (item: T) => number): number;
|
|
716
|
+
|
|
475
717
|
export declare class StateBasedContentEditableAdapter extends AbstractRichtextEditorAdapter implements AsyncAdapterInterface {
|
|
476
718
|
element: HTMLElement;
|
|
477
719
|
constructor(conf: AdapterConf);
|
|
@@ -488,26 +730,49 @@ export declare class StateBasedContentEditableAdapter extends AbstractRichtextEd
|
|
|
488
730
|
scrollIntoView(sel: Selection): Promise<void>;
|
|
489
731
|
}
|
|
490
732
|
|
|
491
|
-
declare interface SuccessfulCheckResult {
|
|
733
|
+
export declare interface SuccessfulCheckResult {
|
|
492
734
|
checkedPart: CheckedDocumentPart;
|
|
493
735
|
embedCheckInformation?: CheckInformationKeyValuePair[];
|
|
494
736
|
inputFormat?: string;
|
|
495
737
|
}
|
|
496
738
|
|
|
497
|
-
declare interface SuccessfulContentExtractionResult {
|
|
739
|
+
export declare interface SuccessfulContentExtractionResult {
|
|
498
740
|
content: string;
|
|
499
741
|
documentReference?: string;
|
|
500
742
|
selection?: DocumentSelection;
|
|
501
743
|
externalContent?: ExternalContent;
|
|
502
744
|
}
|
|
503
745
|
|
|
504
|
-
|
|
746
|
+
/**
|
|
747
|
+
* This wrapper around an AsyncAdapterInterface synchronizes all calls to selectRanges and replaceRanges.
|
|
748
|
+
* Thereby it prevents concurrency issues, that could arise from concurrent calls to these methods in some
|
|
749
|
+
* adapters.
|
|
750
|
+
*/
|
|
751
|
+
export declare class SynchronizeAsyncAdapter implements AsyncAdapterInterface {
|
|
752
|
+
private readonly adapter;
|
|
753
|
+
readonly isAsync = true;
|
|
754
|
+
readonly requiresSynchronization = false;
|
|
755
|
+
readonly getAutobindWrapperAttributes?: () => AutobindWrapperAttributes;
|
|
756
|
+
readonly getFormat?: () => string;
|
|
757
|
+
private workQueue;
|
|
758
|
+
constructor(adapter: AsyncAdapterInterface);
|
|
759
|
+
extractContentForCheck(opts: ExtractContentForCheckOpts): ContentExtractionResult | Promise<ContentExtractionResult>;
|
|
760
|
+
registerCheckCall(checkInfo: Check): void;
|
|
761
|
+
registerCheckResult(checkResult: SuccessfulCheckResult): void;
|
|
762
|
+
selectRanges(checkId: string, matches: Match[]): Promise<void>;
|
|
763
|
+
replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): Promise<void>;
|
|
764
|
+
onInitFinished(result: InitResult): void;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
export declare interface TextDomMapping {
|
|
505
768
|
text: string;
|
|
506
769
|
domPositions: DomPosition[];
|
|
507
770
|
}
|
|
508
771
|
|
|
509
772
|
declare type TextMapping = TextDomMapping;
|
|
510
773
|
|
|
774
|
+
export declare function textMapping(text: string, domPositions: DomPosition[]): TextDomMapping;
|
|
775
|
+
|
|
511
776
|
declare type TextMapping_2 = TextDomMapping;
|
|
512
777
|
|
|
513
778
|
export declare class TinyMCEAdapter extends AbstractRichtextEditorAdapter {
|
|
@@ -520,8 +785,23 @@ export declare class TinyMCEAdapter extends AbstractRichtextEditorAdapter {
|
|
|
520
785
|
getEditorDocument(): Document;
|
|
521
786
|
}
|
|
522
787
|
|
|
788
|
+
export declare const TITLE_BAR_CLASS = "acrolinxFloatingSidebarTitleBar";
|
|
789
|
+
|
|
790
|
+
export declare function toSet(keys: string[]): Readonly<{
|
|
791
|
+
[key: string]: boolean;
|
|
792
|
+
}>;
|
|
793
|
+
|
|
523
794
|
declare type ValidInputElement = HTMLInputElement | HTMLTextAreaElement;
|
|
524
795
|
|
|
796
|
+
export declare function waitMs(ms: number): Promise<unknown>;
|
|
797
|
+
|
|
798
|
+
export declare class WorkQueue {
|
|
799
|
+
private workTodo;
|
|
800
|
+
private currentWork?;
|
|
801
|
+
addWork<T>(work: PromiseProvider<T>): Promise<T>;
|
|
802
|
+
private doRemainingWork;
|
|
803
|
+
}
|
|
804
|
+
|
|
525
805
|
declare interface WrapperConf extends WrapperConfOptions {
|
|
526
806
|
tagName: string;
|
|
527
807
|
attributes: AttributeMap;
|