@acrolinx/sidebar-sdk 2.0.1 → 2.0.3
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 +361 -23
- package/dist/index.js +1118 -923
- package/package.json +14 -14
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;
|
|
@@ -101,20 +106,24 @@ export declare interface AcrolinxSidebarIntegration {
|
|
|
101
106
|
CodeMirror6Adapter: typeof CodeMirror6Adapter;
|
|
102
107
|
CodeMirrorAdapter: typeof CodeMirrorAdapter;
|
|
103
108
|
ContentEditableAdapter: typeof ContentEditableAdapter;
|
|
109
|
+
HerettoContentEditableAdapter: typeof HerettoContentEditableAdapter;
|
|
104
110
|
AsyncContentEditableAdapter: typeof StateBasedContentEditableAdapter;
|
|
105
111
|
InputAdapter: typeof InputAdapter;
|
|
106
112
|
MultiEditorAdapter: typeof MultiEditorAdapter;
|
|
107
113
|
AsyncMultiEditorAdapter: typeof AsyncMultiEditorAdapter;
|
|
108
114
|
TinyMCEAdapter: typeof TinyMCEAdapter;
|
|
109
115
|
XeditorAdapter: typeof XeditorAdapter;
|
|
116
|
+
QuipAdapter: typeof QuipAdapter;
|
|
117
|
+
SynchronizeAsyncAdapter: typeof SynchronizeAsyncAdapter;
|
|
110
118
|
};
|
|
111
119
|
lookup: {
|
|
112
120
|
lookupMatches: typeof lookupMatches;
|
|
113
121
|
};
|
|
114
|
-
extractTextDomMapping: typeof extractTextDomMapping;
|
|
115
122
|
}
|
|
116
123
|
|
|
117
|
-
declare type
|
|
124
|
+
declare type AcrolinxSidebarPlugin = acrolinxSidebarInterfaces.AcrolinxPlugin;
|
|
125
|
+
|
|
126
|
+
export declare type AdapterConf = HasEditorID | HasElement;
|
|
118
127
|
|
|
119
128
|
export declare interface AdapterInterface extends CommonAdapterInterface {
|
|
120
129
|
selectRanges(checkId: string, matches: Match[]): void;
|
|
@@ -123,11 +132,15 @@ export declare interface AdapterInterface extends CommonAdapterInterface {
|
|
|
123
132
|
|
|
124
133
|
declare type AddSingleAdapterOptions = WrapperConfOptions;
|
|
125
134
|
|
|
126
|
-
declare interface AlignedMatch<T extends Match> {
|
|
135
|
+
export declare interface AlignedMatch<T extends Match> {
|
|
127
136
|
originalMatch: T;
|
|
128
137
|
range: [number, number];
|
|
129
138
|
}
|
|
130
139
|
|
|
140
|
+
export declare function assertElementIsDisplayed(element: Element): void;
|
|
141
|
+
|
|
142
|
+
export declare function assign<T, U>(obj: T, update: U): T & U;
|
|
143
|
+
|
|
131
144
|
export declare interface AsyncAdapterInterface extends CommonAdapterInterface {
|
|
132
145
|
readonly isAsync: true;
|
|
133
146
|
readonly requiresSynchronization: boolean;
|
|
@@ -163,7 +176,7 @@ export declare class AsyncMultiEditorAdapter extends MultiEditorAdapter implemen
|
|
|
163
176
|
replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): Promise<void>;
|
|
164
177
|
}
|
|
165
178
|
|
|
166
|
-
declare interface AsyncStorage {
|
|
179
|
+
export declare interface AsyncStorage {
|
|
167
180
|
get<T>(key: string): Promise<T | null>;
|
|
168
181
|
set<T>(key: string, value: T): Promise<void>;
|
|
169
182
|
}
|
|
@@ -172,6 +185,10 @@ declare type AttributeMap = {
|
|
|
172
185
|
[key: string]: any;
|
|
173
186
|
};
|
|
174
187
|
|
|
188
|
+
export declare const AUTO_SELF_CLOSING_LINE_TAGS: Readonly<{
|
|
189
|
+
[key: string]: boolean;
|
|
190
|
+
}>;
|
|
191
|
+
|
|
175
192
|
export declare class AutoBindAdapter implements AdapterInterface {
|
|
176
193
|
private conf;
|
|
177
194
|
private multiAdapter;
|
|
@@ -185,19 +202,20 @@ export declare class AutoBindAdapter implements AdapterInterface {
|
|
|
185
202
|
replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): void;
|
|
186
203
|
}
|
|
187
204
|
|
|
188
|
-
declare interface AutobindConfig extends CommonAdapterConf {
|
|
205
|
+
export declare interface AutobindConfig extends CommonAdapterConf {
|
|
189
206
|
enableQuipAdapter?: boolean;
|
|
207
|
+
enableHerettoAdapter?: boolean;
|
|
190
208
|
}
|
|
191
209
|
|
|
192
210
|
export declare function autoBindFloatingSidebar(basicConf: AutoBindFloatingSidebarConfig): Promise<FloatingSidebar>;
|
|
193
211
|
|
|
194
212
|
export declare function autoBindFloatingSidebarAsync(basicConf: AutoBindFloatingSidebarConfig): Promise<FloatingSidebar>;
|
|
195
213
|
|
|
196
|
-
declare interface AutoBindFloatingSidebarConfig extends AcrolinxPluginConfig, MultiEditorAdapterConfig, AutobindConfig {
|
|
214
|
+
export declare interface AutoBindFloatingSidebarConfig extends AcrolinxPluginConfig, MultiEditorAdapterConfig, AutobindConfig {
|
|
197
215
|
asyncStorage?: AsyncStorage;
|
|
198
216
|
}
|
|
199
217
|
|
|
200
|
-
declare interface AutobindWrapperAttributes {
|
|
218
|
+
export declare interface AutobindWrapperAttributes {
|
|
201
219
|
'original-id'?: string;
|
|
202
220
|
'original-class'?: string;
|
|
203
221
|
'original-name'?: string;
|
|
@@ -206,6 +224,10 @@ declare interface AutobindWrapperAttributes {
|
|
|
206
224
|
[key: string]: string | undefined;
|
|
207
225
|
}
|
|
208
226
|
|
|
227
|
+
export declare function bindAdaptersForCurrentPage(conf?: AutobindConfig): AdapterInterface[];
|
|
228
|
+
|
|
229
|
+
export declare const browser: DetectedBrowser;
|
|
230
|
+
|
|
209
231
|
declare interface CheckContentResult {
|
|
210
232
|
dom: HTMLElement;
|
|
211
233
|
text: string;
|
|
@@ -241,6 +263,15 @@ export declare class CKEditorAdapter extends AbstractRichtextEditorAdapter {
|
|
|
241
263
|
isInWysiwygMode(): boolean;
|
|
242
264
|
}
|
|
243
265
|
|
|
266
|
+
export declare const CLIENT_COMPONENT_MAIN_FALLBACK: {
|
|
267
|
+
id: string;
|
|
268
|
+
name: string;
|
|
269
|
+
version: string;
|
|
270
|
+
category: string;
|
|
271
|
+
}[];
|
|
272
|
+
|
|
273
|
+
export declare const CLOSE_ICON_CLASS = "acrolinxFloatingSidebarCloseIcon";
|
|
274
|
+
|
|
244
275
|
export declare class CodeMirror6Adapter implements AdapterInterface {
|
|
245
276
|
private config;
|
|
246
277
|
private currentContentChecking?;
|
|
@@ -299,7 +330,7 @@ declare type CodeMirrorAdapterConf = {
|
|
|
299
330
|
format?: string;
|
|
300
331
|
};
|
|
301
332
|
|
|
302
|
-
declare interface CommonAdapterConf {
|
|
333
|
+
export declare interface CommonAdapterConf {
|
|
303
334
|
scrollOffsetY?: number;
|
|
304
335
|
disableInputEventSimulation?: boolean;
|
|
305
336
|
}
|
|
@@ -314,6 +345,15 @@ export declare interface CommonAdapterInterface {
|
|
|
314
345
|
onInitFinished?(result: InitResult): void;
|
|
315
346
|
}
|
|
316
347
|
|
|
348
|
+
export declare function concatTextMappings(textMappings: TextDomMapping[]): TextDomMapping;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Connects to a sidebar iframe that is on a different domain and uses the plugin message adapter.
|
|
352
|
+
*/
|
|
353
|
+
export declare function connectAcrolinxPluginToMessages(acrolinxPlugin: InternalAcrolinxSidebarPluginInterface, sidebarWindowIframe: HTMLIFrameElement): void;
|
|
354
|
+
|
|
355
|
+
export declare function containsText(s: string): boolean;
|
|
356
|
+
|
|
317
357
|
export declare class ContentEditableAdapter extends AbstractRichtextEditorAdapter {
|
|
318
358
|
element: HTMLElement;
|
|
319
359
|
constructor(conf: AdapterConf);
|
|
@@ -323,57 +363,156 @@ export declare class ContentEditableAdapter extends AbstractRichtextEditorAdapte
|
|
|
323
363
|
getEditorDocument(): Document;
|
|
324
364
|
}
|
|
325
365
|
|
|
326
|
-
declare type ContentExtractionResult = SuccessfulContentExtractionResult | HasError;
|
|
366
|
+
export declare type ContentExtractionResult = SuccessfulContentExtractionResult | HasError;
|
|
367
|
+
|
|
368
|
+
export declare function createOffsetMappingArray(diffs: Diff[]): OffSetAlign[];
|
|
327
369
|
|
|
328
370
|
/**
|
|
329
371
|
* Used inside of a sidebar iframe on a different domain.
|
|
330
372
|
*/
|
|
331
373
|
export declare function createPluginMessageAdapter(win?: Window & typeof globalThis): AcrolinxPlugin_2;
|
|
332
374
|
|
|
333
|
-
declare
|
|
375
|
+
export declare function deepCloneWithHTMLElement<T>(obj: T): T;
|
|
376
|
+
|
|
377
|
+
export declare function deepFreezed<T>(o: T): T;
|
|
378
|
+
|
|
379
|
+
export declare const DEFAULT_POS: Position;
|
|
380
|
+
|
|
381
|
+
export declare class Deferred<T> {
|
|
382
|
+
resolve: (x: T) => void;
|
|
383
|
+
reject: (x: T) => void;
|
|
384
|
+
promise: Promise<T>;
|
|
385
|
+
constructor();
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export declare interface DetectedBrowser {
|
|
389
|
+
name: string;
|
|
390
|
+
version: string;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export declare interface DomPosition {
|
|
334
394
|
node: Node;
|
|
335
395
|
offset: number;
|
|
336
396
|
}
|
|
337
397
|
|
|
398
|
+
export declare function domPosition(node: Node, offset: number): DomPosition;
|
|
399
|
+
|
|
400
|
+
export declare const EDITABLE_ELEMENTS_SELECTOR: string;
|
|
401
|
+
|
|
338
402
|
declare type ElementHtmlGetter = (el: HTMLElement) => string;
|
|
339
403
|
|
|
340
|
-
declare
|
|
404
|
+
export declare function enableLogging(): void;
|
|
405
|
+
|
|
406
|
+
export declare function escapeHtmlCharacters(text: string): EscapeHtmlCharactersResult;
|
|
407
|
+
|
|
408
|
+
export declare interface EscapeHtmlCharactersResult {
|
|
341
409
|
escapedText: string;
|
|
342
410
|
backwardAlignment: OffSetAlign[];
|
|
343
411
|
}
|
|
344
412
|
|
|
345
|
-
declare interface ExtractContentForCheckOpts {
|
|
413
|
+
export declare interface ExtractContentForCheckOpts {
|
|
346
414
|
checkSelection?: boolean;
|
|
347
415
|
}
|
|
348
416
|
|
|
417
|
+
export declare function extractText(s: string): [string, OffSetAlign[]];
|
|
418
|
+
|
|
349
419
|
export declare function extractTextDomMapping(node: Node): TextDomMapping;
|
|
350
420
|
|
|
351
|
-
declare
|
|
421
|
+
export declare function findDisplacement(offsetMappingArray: OffSetAlign[], originalIndex: number): number;
|
|
422
|
+
|
|
423
|
+
export declare function findNewIndex(offsetMappingArray: OffSetAlign[], originalIndex: number): number;
|
|
424
|
+
|
|
425
|
+
export declare interface FloatingSidebar {
|
|
352
426
|
toggleVisibility(): void;
|
|
353
427
|
remove(): void;
|
|
354
428
|
}
|
|
355
429
|
|
|
356
|
-
declare interface FloatingSidebarConfig {
|
|
430
|
+
export declare interface FloatingSidebarConfig {
|
|
357
431
|
asyncStorage: AsyncStorage;
|
|
358
432
|
sidebarContainerId?: string;
|
|
359
433
|
}
|
|
360
434
|
|
|
435
|
+
export declare const FOOTER = "acrolinxFloatingSidebarFooter";
|
|
436
|
+
|
|
437
|
+
export declare const FOOTER_HEIGHT = 34;
|
|
438
|
+
|
|
361
439
|
declare type Format = 'TEXT' | 'MARKDOWN';
|
|
362
440
|
|
|
441
|
+
export declare function getAutobindWrapperAttributes(element: Element): AutobindWrapperAttributes;
|
|
442
|
+
|
|
443
|
+
export declare function getCompleteFlagLength<T extends Match>(matches: AlignedMatch<T>[]): number;
|
|
444
|
+
|
|
445
|
+
export declare function getEditableElements(doc?: Document | ShadowRoot | HTMLElement): Element[];
|
|
446
|
+
|
|
447
|
+
export declare function getElementFromAdapterConf(conf: AdapterConf): HTMLElement;
|
|
448
|
+
|
|
449
|
+
export declare function getEndDomPos(endIndex: number, domPositions: DomPosition[]): DomPosition;
|
|
450
|
+
|
|
363
451
|
export declare function getSelectionHtmlRanges(editorElement: HTMLElement, getElementHtml?: ElementHtmlGetter): [number, number][];
|
|
364
452
|
|
|
365
|
-
declare
|
|
453
|
+
export declare function grepAttributeValues(html: string, attribute: string): string[];
|
|
454
|
+
|
|
455
|
+
export declare interface HasEditorID extends CommonAdapterConf {
|
|
366
456
|
editorId: string;
|
|
367
457
|
}
|
|
368
458
|
|
|
369
|
-
declare
|
|
459
|
+
export declare function hasEditorID(a: AdapterConf): a is HasEditorID;
|
|
460
|
+
|
|
461
|
+
export declare interface HasElement extends CommonAdapterConf {
|
|
370
462
|
element: HTMLElement;
|
|
371
463
|
}
|
|
372
464
|
|
|
373
|
-
declare
|
|
465
|
+
export declare function hasElement(a: AdapterConf): a is HasElement;
|
|
466
|
+
|
|
467
|
+
export declare interface HasError {
|
|
374
468
|
error: any;
|
|
375
469
|
}
|
|
376
470
|
|
|
471
|
+
export declare function hasError(a: ContentExtractionResult): a is HasError;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Custom adapter for Heretto.com that extends AsyncContentEditableAdapter
|
|
475
|
+
* with custom selectRanges and replaceRanges implementation.
|
|
476
|
+
*
|
|
477
|
+
*/
|
|
478
|
+
export declare class HerettoContentEditableAdapter extends StateBasedContentEditableAdapter {
|
|
479
|
+
constructor(conf: AdapterConf);
|
|
480
|
+
/**
|
|
481
|
+
* Override selectRanges to add Heretto-specific event dispatching.
|
|
482
|
+
*
|
|
483
|
+
* @param checkId - The check ID
|
|
484
|
+
* @param matches - Array of matches to select
|
|
485
|
+
* @returns Promise that resolves when selection is complete
|
|
486
|
+
*/
|
|
487
|
+
selectRanges(checkId: string, matches: Match[]): Promise<void>;
|
|
488
|
+
/**
|
|
489
|
+
* Dispatch mouseup and selectionchange events to notify Heretto's GWT editor
|
|
490
|
+
* about the selection change.
|
|
491
|
+
*/
|
|
492
|
+
private dispatchHerettoSelectionEvents;
|
|
493
|
+
/**
|
|
494
|
+
* Override replaceRanges with custom implementation for Heretto.com.
|
|
495
|
+
* Uses paste event to apply replacements in the Heretto editor.
|
|
496
|
+
*
|
|
497
|
+
* The replacement is done asynchronously:
|
|
498
|
+
* 1. First select the text
|
|
499
|
+
* 2. Wait for selection events to propagate
|
|
500
|
+
* 3. Apply replacement via paste event
|
|
501
|
+
*
|
|
502
|
+
* @param checkId - The check ID
|
|
503
|
+
* @param matchesWithReplacement - Array of matches with replacement suggestions
|
|
504
|
+
* @returns Promise that resolves when replacement is complete, rejects on error
|
|
505
|
+
*/
|
|
506
|
+
replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): Promise<void>;
|
|
507
|
+
/**
|
|
508
|
+
* Apply replacement text using the paste event.
|
|
509
|
+
*
|
|
510
|
+
* @param replacementText - The text to insert in place of the selection
|
|
511
|
+
* @throws Error if editor is not found or not editable
|
|
512
|
+
*/
|
|
513
|
+
private applyReplacementViaPaste;
|
|
514
|
+
}
|
|
515
|
+
|
|
377
516
|
export declare function initFloatingSidebar(config: FloatingSidebarConfig): FloatingSidebar;
|
|
378
517
|
|
|
379
518
|
export declare class InputAdapter implements AdapterInterface {
|
|
@@ -401,7 +540,63 @@ declare type InputAdapterConf = AdapterConf & {
|
|
|
401
540
|
format?: Format;
|
|
402
541
|
};
|
|
403
542
|
|
|
404
|
-
declare type InputFormat = 'HTML' | 'TEXT';
|
|
543
|
+
export declare type InputFormat = 'HTML' | 'TEXT';
|
|
544
|
+
|
|
545
|
+
declare interface InternalAcrolinxSidebarPluginInterface extends AcrolinxSidebarPlugin {
|
|
546
|
+
requestInit(acrolinxSidebarArg?: AcrolinxSidebar): void;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export declare function internalFetch(url: string): Promise<string>;
|
|
550
|
+
|
|
551
|
+
export declare const IS_DRAGGED_CLASS = "acrolinxFloatingSidebarIsDragged";
|
|
552
|
+
|
|
553
|
+
export declare const IS_RESIZING_CLASS = "acrolinxFloatingSidebarIsResizing";
|
|
554
|
+
|
|
555
|
+
export declare function isAsyncAdapterInterface(a: AdapterInterface | AsyncAdapterInterface): a is AsyncAdapterInterface;
|
|
556
|
+
|
|
557
|
+
export declare function isChrome(): boolean;
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* We don't want to destroy markup/markdown.
|
|
561
|
+
*/
|
|
562
|
+
export declare function isDangerousToReplace(checkedDocumentContent: string, originalMatch: Match): boolean;
|
|
563
|
+
|
|
564
|
+
export declare function isDisplayed(element: Element): boolean;
|
|
565
|
+
|
|
566
|
+
export declare function isFromSameOrigin(url: string): boolean;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Check if the element is in a Heretto.com DITA editor.
|
|
570
|
+
*
|
|
571
|
+
* Detection is based on multiple robust identifiers:
|
|
572
|
+
* 1. Domain check: must be on heretto.com
|
|
573
|
+
* 2. Iframe ID: element must be inside iframe with id "gwt-debug-PreviewViewImpl.previewFrame"
|
|
574
|
+
* 3. Body class: Heretto editor body has class "heretto"
|
|
575
|
+
*
|
|
576
|
+
* @param el - The element to check
|
|
577
|
+
* @returns true if element is in the Heretto DITA editor
|
|
578
|
+
*/
|
|
579
|
+
export declare function isHeretto(el: Element): boolean;
|
|
580
|
+
|
|
581
|
+
export declare function isIFrame(el: Element): el is HTMLIFrameElement;
|
|
582
|
+
|
|
583
|
+
export declare function isProbablyUndesiredField(el: Element): boolean;
|
|
584
|
+
|
|
585
|
+
export declare function isPromise<T>(result: T | Promise<T>): result is Promise<T>;
|
|
586
|
+
|
|
587
|
+
export declare function isSuccessfulContentExtractionResult(a: ContentExtractionResult): a is SuccessfulContentExtractionResult;
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Exported only for testing.
|
|
591
|
+
*/
|
|
592
|
+
export declare function keepVisible({ left, top, height }: Position, windowWidth?: number, windowHeight?: number): Position;
|
|
593
|
+
|
|
594
|
+
export declare function loadFromLocalStorage<T>(key: string): T | null;
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Exported only for testing.
|
|
598
|
+
*/
|
|
599
|
+
export declare function loadInitialPos(asyncStorage: AsyncStorage): Promise<Position>;
|
|
405
600
|
|
|
406
601
|
/**
|
|
407
602
|
* Loads the Styles and Scripts of the sidebar into the current window.
|
|
@@ -411,6 +606,10 @@ declare type InputFormat = 'HTML' | 'TEXT';
|
|
|
411
606
|
*/
|
|
412
607
|
export declare function loadSidebarCode(sidebarBaseUrl: string): Promise<void>;
|
|
413
608
|
|
|
609
|
+
export declare function log(message: any, ...args: any[]): void;
|
|
610
|
+
|
|
611
|
+
export declare function logTime(text: string, f: Function): any;
|
|
612
|
+
|
|
414
613
|
/**
|
|
415
614
|
* @param {string} checkedDocument Text or HTML of the document (at check time)
|
|
416
615
|
* @param {string} currentDocument Text or HTML of the current document
|
|
@@ -447,18 +646,68 @@ export declare class MultiEditorAdapter implements AdapterInterface {
|
|
|
447
646
|
replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): void;
|
|
448
647
|
}
|
|
449
648
|
|
|
450
|
-
declare interface MultiEditorAdapterConfig {
|
|
649
|
+
export declare interface MultiEditorAdapterConfig {
|
|
451
650
|
aggregateFormat?: 'AUTO' | 'HTML';
|
|
452
651
|
documentHeader?: string;
|
|
453
652
|
rootElement?: WrapperConfOptions;
|
|
454
653
|
beforeCheck?: (multiAdapter: MultiEditorAdapter) => void;
|
|
455
654
|
}
|
|
456
655
|
|
|
457
|
-
declare
|
|
656
|
+
export declare const NEW_LINE_TAGS: Readonly<{
|
|
657
|
+
[key: string]: boolean;
|
|
658
|
+
}>;
|
|
659
|
+
|
|
660
|
+
export declare interface OffSetAlign {
|
|
458
661
|
oldPosition: number;
|
|
459
662
|
diffOffset: number;
|
|
460
663
|
}
|
|
461
664
|
|
|
665
|
+
export declare function parseUrl(href: string): {
|
|
666
|
+
protocol: string;
|
|
667
|
+
host: string;
|
|
668
|
+
hostname: string;
|
|
669
|
+
port: string;
|
|
670
|
+
pathname: string;
|
|
671
|
+
hash: string;
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
export declare interface Position extends PositionUpdate {
|
|
675
|
+
top: number;
|
|
676
|
+
left: number;
|
|
677
|
+
height: number;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
export declare const POSITION_KEY = "acrolinx.plugins.floatingSidebar.position";
|
|
681
|
+
|
|
682
|
+
export declare interface PositionUpdate {
|
|
683
|
+
top?: number;
|
|
684
|
+
left?: number;
|
|
685
|
+
height?: number;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
export declare type PromiseProvider<T> = () => PromiseLike<T>;
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Just a proof of concept.
|
|
692
|
+
*/
|
|
693
|
+
export declare class QuipAdapter extends AbstractRichtextEditorAdapter {
|
|
694
|
+
element: HTMLElement;
|
|
695
|
+
constructor(conf: AdapterConf);
|
|
696
|
+
getEditorElement(): HTMLElement;
|
|
697
|
+
getContent(): string;
|
|
698
|
+
protected getSelection(): DocumentSelection;
|
|
699
|
+
getEditorDocument(): Document;
|
|
700
|
+
replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): Promise<void>;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export declare function rangeContent(content: string, m: {
|
|
704
|
+
range: [number, number];
|
|
705
|
+
}): string;
|
|
706
|
+
|
|
707
|
+
export declare function rebaseRelativeUrl(url: string, sidebarBaseUrl: string): string;
|
|
708
|
+
|
|
709
|
+
export declare function rebaseRelativeUrls(sidebarHtml: string, sidebarBaseUrl: string): string;
|
|
710
|
+
|
|
462
711
|
declare interface RegisteredAdapter {
|
|
463
712
|
id: string;
|
|
464
713
|
adapter: AdapterInterface | AsyncAdapterInterface;
|
|
@@ -472,6 +721,57 @@ declare interface RemappedMatches<T extends Match> {
|
|
|
472
721
|
adapter: AdapterInterface;
|
|
473
722
|
}
|
|
474
723
|
|
|
724
|
+
export declare function removeNode(node: Node): void;
|
|
725
|
+
|
|
726
|
+
export declare const RESIZE_ICON_CLASS = "acrolinxFloatingSidebarResizeIcon";
|
|
727
|
+
|
|
728
|
+
export declare function saveToLocalStorage<T>(key: string, object: T): void;
|
|
729
|
+
|
|
730
|
+
export declare function scrollIntoView(targetEl: HTMLElement, windowTopOffset?: number, localTopOffset?: number): void;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* @return indicates if it succeeded
|
|
734
|
+
*/
|
|
735
|
+
export declare function scrollIntoViewCenteredIfPossible(targetEl: HTMLElement): boolean;
|
|
736
|
+
|
|
737
|
+
export declare function scrollIntoViewCenteredWithFallback(targetEl: HTMLElement): void;
|
|
738
|
+
|
|
739
|
+
export declare let SIDEBAR_CONTAINER_ID: string;
|
|
740
|
+
|
|
741
|
+
export declare const SIDEBAR_DRAG_OVERLAY_ID = "acrolinxDragOverlay";
|
|
742
|
+
|
|
743
|
+
export declare const SIDEBAR_GLASS_PANE_ID = "acrolinxFloatingSidebarGlassPane";
|
|
744
|
+
|
|
745
|
+
export declare const SIDEBAR_ID = "acrolinxFloatingSidebar";
|
|
746
|
+
|
|
747
|
+
export declare const SIDEBAR_SDK_COMPONENT: {
|
|
748
|
+
id: string;
|
|
749
|
+
name: string;
|
|
750
|
+
version: string;
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
export declare class SidebarURLInvalidError extends Error {
|
|
754
|
+
message: string;
|
|
755
|
+
configuredSidebarURL: string;
|
|
756
|
+
htmlLoaded: string;
|
|
757
|
+
details: string;
|
|
758
|
+
constructor(message: string, configuredSidebarURL: string, htmlLoaded: string);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
export declare function simulateInputEvent(props: SimulateInputEventProps): void;
|
|
762
|
+
|
|
763
|
+
export declare type SimulateInputEventProps = {
|
|
764
|
+
startNode: Node;
|
|
765
|
+
endNode: Node;
|
|
766
|
+
eventType: string;
|
|
767
|
+
startOffset: number;
|
|
768
|
+
endOffset: number;
|
|
769
|
+
replacement: string;
|
|
770
|
+
disableSimulation?: boolean;
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
export declare function sortedIndexBy<T>(array: T[], value: T, iteratee: (item: T) => number): number;
|
|
774
|
+
|
|
475
775
|
export declare class StateBasedContentEditableAdapter extends AbstractRichtextEditorAdapter implements AsyncAdapterInterface {
|
|
476
776
|
element: HTMLElement;
|
|
477
777
|
constructor(conf: AdapterConf);
|
|
@@ -488,26 +788,49 @@ export declare class StateBasedContentEditableAdapter extends AbstractRichtextEd
|
|
|
488
788
|
scrollIntoView(sel: Selection): Promise<void>;
|
|
489
789
|
}
|
|
490
790
|
|
|
491
|
-
declare interface SuccessfulCheckResult {
|
|
791
|
+
export declare interface SuccessfulCheckResult {
|
|
492
792
|
checkedPart: CheckedDocumentPart;
|
|
493
793
|
embedCheckInformation?: CheckInformationKeyValuePair[];
|
|
494
794
|
inputFormat?: string;
|
|
495
795
|
}
|
|
496
796
|
|
|
497
|
-
declare interface SuccessfulContentExtractionResult {
|
|
797
|
+
export declare interface SuccessfulContentExtractionResult {
|
|
498
798
|
content: string;
|
|
499
799
|
documentReference?: string;
|
|
500
800
|
selection?: DocumentSelection;
|
|
501
801
|
externalContent?: ExternalContent;
|
|
502
802
|
}
|
|
503
803
|
|
|
504
|
-
|
|
804
|
+
/**
|
|
805
|
+
* This wrapper around an AsyncAdapterInterface synchronizes all calls to selectRanges and replaceRanges.
|
|
806
|
+
* Thereby it prevents concurrency issues, that could arise from concurrent calls to these methods in some
|
|
807
|
+
* adapters.
|
|
808
|
+
*/
|
|
809
|
+
export declare class SynchronizeAsyncAdapter implements AsyncAdapterInterface {
|
|
810
|
+
private readonly adapter;
|
|
811
|
+
readonly isAsync = true;
|
|
812
|
+
readonly requiresSynchronization = false;
|
|
813
|
+
readonly getAutobindWrapperAttributes?: () => AutobindWrapperAttributes;
|
|
814
|
+
readonly getFormat?: () => string;
|
|
815
|
+
private workQueue;
|
|
816
|
+
constructor(adapter: AsyncAdapterInterface);
|
|
817
|
+
extractContentForCheck(opts: ExtractContentForCheckOpts): ContentExtractionResult | Promise<ContentExtractionResult>;
|
|
818
|
+
registerCheckCall(checkInfo: Check): void;
|
|
819
|
+
registerCheckResult(checkResult: SuccessfulCheckResult): void;
|
|
820
|
+
selectRanges(checkId: string, matches: Match[]): Promise<void>;
|
|
821
|
+
replaceRanges(checkId: string, matchesWithReplacement: MatchWithReplacement[]): Promise<void>;
|
|
822
|
+
onInitFinished(result: InitResult): void;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
export declare interface TextDomMapping {
|
|
505
826
|
text: string;
|
|
506
827
|
domPositions: DomPosition[];
|
|
507
828
|
}
|
|
508
829
|
|
|
509
830
|
declare type TextMapping = TextDomMapping;
|
|
510
831
|
|
|
832
|
+
export declare function textMapping(text: string, domPositions: DomPosition[]): TextDomMapping;
|
|
833
|
+
|
|
511
834
|
declare type TextMapping_2 = TextDomMapping;
|
|
512
835
|
|
|
513
836
|
export declare class TinyMCEAdapter extends AbstractRichtextEditorAdapter {
|
|
@@ -520,8 +843,23 @@ export declare class TinyMCEAdapter extends AbstractRichtextEditorAdapter {
|
|
|
520
843
|
getEditorDocument(): Document;
|
|
521
844
|
}
|
|
522
845
|
|
|
846
|
+
export declare const TITLE_BAR_CLASS = "acrolinxFloatingSidebarTitleBar";
|
|
847
|
+
|
|
848
|
+
export declare function toSet(keys: string[]): Readonly<{
|
|
849
|
+
[key: string]: boolean;
|
|
850
|
+
}>;
|
|
851
|
+
|
|
523
852
|
declare type ValidInputElement = HTMLInputElement | HTMLTextAreaElement;
|
|
524
853
|
|
|
854
|
+
export declare function waitMs(ms: number): Promise<unknown>;
|
|
855
|
+
|
|
856
|
+
export declare class WorkQueue {
|
|
857
|
+
private workTodo;
|
|
858
|
+
private currentWork?;
|
|
859
|
+
addWork<T>(work: PromiseProvider<T>): Promise<T>;
|
|
860
|
+
private doRemainingWork;
|
|
861
|
+
}
|
|
862
|
+
|
|
525
863
|
declare interface WrapperConf extends WrapperConfOptions {
|
|
526
864
|
tagName: string;
|
|
527
865
|
attributes: AttributeMap;
|