tinymce.d.ts 119 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116
  1. interface StringPathBookmark {
  2. start: string;
  3. end?: string;
  4. forward?: boolean;
  5. }
  6. interface RangeBookmark {
  7. rng: Range;
  8. forward?: boolean;
  9. }
  10. interface IdBookmark {
  11. id: string;
  12. keep?: boolean;
  13. forward?: boolean;
  14. }
  15. interface IndexBookmark {
  16. name: string;
  17. index: number;
  18. }
  19. interface PathBookmark {
  20. start: number[];
  21. end?: number[];
  22. isFakeCaret?: boolean;
  23. forward?: boolean;
  24. }
  25. declare type Bookmark = StringPathBookmark | RangeBookmark | IdBookmark | IndexBookmark | PathBookmark;
  26. declare type NormalizedEvent<E, T = any> = E & {
  27. readonly type: string;
  28. readonly target: T;
  29. readonly isDefaultPrevented: () => boolean;
  30. readonly preventDefault: () => void;
  31. readonly isPropagationStopped: () => boolean;
  32. readonly stopPropagation: () => void;
  33. readonly isImmediatePropagationStopped: () => boolean;
  34. readonly stopImmediatePropagation: () => void;
  35. };
  36. declare type MappedEvent<T extends {}, K extends string> = K extends keyof T ? T[K] : any;
  37. interface NativeEventMap {
  38. 'beforepaste': Event;
  39. 'blur': FocusEvent;
  40. 'beforeinput': InputEvent;
  41. 'click': MouseEvent;
  42. 'compositionend': Event;
  43. 'compositionstart': Event;
  44. 'compositionupdate': Event;
  45. 'contextmenu': PointerEvent;
  46. 'copy': ClipboardEvent;
  47. 'cut': ClipboardEvent;
  48. 'dblclick': MouseEvent;
  49. 'drag': DragEvent;
  50. 'dragdrop': DragEvent;
  51. 'dragend': DragEvent;
  52. 'draggesture': DragEvent;
  53. 'dragover': DragEvent;
  54. 'dragstart': DragEvent;
  55. 'drop': DragEvent;
  56. 'focus': FocusEvent;
  57. 'focusin': FocusEvent;
  58. 'focusout': FocusEvent;
  59. 'input': InputEvent;
  60. 'keydown': KeyboardEvent;
  61. 'keypress': KeyboardEvent;
  62. 'keyup': KeyboardEvent;
  63. 'mousedown': MouseEvent;
  64. 'mouseenter': MouseEvent;
  65. 'mouseleave': MouseEvent;
  66. 'mousemove': MouseEvent;
  67. 'mouseout': MouseEvent;
  68. 'mouseover': MouseEvent;
  69. 'mouseup': MouseEvent;
  70. 'paste': ClipboardEvent;
  71. 'selectionchange': Event;
  72. 'submit': Event;
  73. 'touchend': TouchEvent;
  74. 'touchmove': TouchEvent;
  75. 'touchstart': TouchEvent;
  76. 'touchcancel': TouchEvent;
  77. 'wheel': WheelEvent;
  78. }
  79. declare type EditorEvent<T> = NormalizedEvent<T>;
  80. interface EventDispatcherSettings {
  81. scope?: any;
  82. toggleEvent?: (name: string, state: boolean) => void | boolean;
  83. beforeFire?: <T>(args: EditorEvent<T>) => void;
  84. }
  85. interface EventDispatcherConstructor<T extends {}> {
  86. readonly prototype: EventDispatcher<T>;
  87. new (settings?: EventDispatcherSettings): EventDispatcher<T>;
  88. isNative: (name: string) => boolean;
  89. }
  90. declare class EventDispatcher<T extends {}> {
  91. static isNative(name: string): boolean;
  92. private readonly settings;
  93. private readonly scope;
  94. private readonly toggleEvent;
  95. private bindings;
  96. constructor(settings?: EventDispatcherSettings);
  97. fire<K extends string, U extends MappedEvent<T, K>>(name: K, args?: U): EditorEvent<U>;
  98. dispatch<K extends string, U extends MappedEvent<T, K>>(name: K, args?: U): EditorEvent<U>;
  99. on<K extends string>(name: K, callback: false | ((event: EditorEvent<MappedEvent<T, K>>) => void | boolean), prepend?: boolean, extra?: {}): this;
  100. off<K extends string>(name?: K, callback?: (event: EditorEvent<MappedEvent<T, K>>) => void): this;
  101. once<K extends string>(name: K, callback: (event: EditorEvent<MappedEvent<T, K>>) => void, prepend?: boolean): this;
  102. has(name: string): boolean;
  103. }
  104. declare const enum UndoLevelType {
  105. Fragmented = "fragmented",
  106. Complete = "complete"
  107. }
  108. interface BaseUndoLevel {
  109. type: UndoLevelType;
  110. bookmark: Bookmark | null;
  111. beforeBookmark: Bookmark | null;
  112. }
  113. interface FragmentedUndoLevel extends BaseUndoLevel {
  114. type: UndoLevelType.Fragmented;
  115. fragments: string[];
  116. content: '';
  117. }
  118. interface CompleteUndoLevel extends BaseUndoLevel {
  119. type: UndoLevelType.Complete;
  120. fragments: null;
  121. content: string;
  122. }
  123. declare type NewUndoLevel = CompleteUndoLevel | FragmentedUndoLevel;
  124. declare type UndoLevel = NewUndoLevel & {
  125. bookmark: Bookmark;
  126. };
  127. interface UndoManager {
  128. data: UndoLevel[];
  129. typing: boolean;
  130. add: (level?: Partial<UndoLevel>, event?: EditorEvent<any>) => UndoLevel | null;
  131. dispatchChange: () => void;
  132. beforeChange: () => void;
  133. undo: () => UndoLevel | undefined;
  134. redo: () => UndoLevel | undefined;
  135. clear: () => void;
  136. reset: () => void;
  137. hasUndo: () => boolean;
  138. hasRedo: () => boolean;
  139. transact: (callback: () => void) => UndoLevel | null;
  140. ignore: (callback: () => void) => void;
  141. extra: (callback1: () => void, callback2: () => void) => void;
  142. }
  143. declare type SchemaType = 'html4' | 'html5' | 'html5-strict';
  144. interface ElementSettings {
  145. block_elements?: string;
  146. boolean_attributes?: string;
  147. move_caret_before_on_enter_elements?: string;
  148. non_empty_elements?: string;
  149. self_closing_elements?: string;
  150. text_block_elements?: string;
  151. text_inline_elements?: string;
  152. void_elements?: string;
  153. whitespace_elements?: string;
  154. transparent_elements?: string;
  155. }
  156. interface SchemaSettings extends ElementSettings {
  157. custom_elements?: string;
  158. extended_valid_elements?: string;
  159. invalid_elements?: string;
  160. invalid_styles?: string | Record<string, string>;
  161. schema?: SchemaType;
  162. valid_children?: string;
  163. valid_classes?: string | Record<string, string>;
  164. valid_elements?: string;
  165. valid_styles?: string | Record<string, string>;
  166. verify_html?: boolean;
  167. padd_empty_block_inline_children?: boolean;
  168. }
  169. interface Attribute {
  170. required?: boolean;
  171. defaultValue?: string;
  172. forcedValue?: string;
  173. validValues?: Record<string, {}>;
  174. }
  175. interface DefaultAttribute {
  176. name: string;
  177. value: string;
  178. }
  179. interface AttributePattern extends Attribute {
  180. pattern: RegExp;
  181. }
  182. interface ElementRule {
  183. attributes: Record<string, Attribute>;
  184. attributesDefault?: DefaultAttribute[];
  185. attributesForced?: DefaultAttribute[];
  186. attributesOrder: string[];
  187. attributePatterns?: AttributePattern[];
  188. attributesRequired?: string[];
  189. paddEmpty?: boolean;
  190. removeEmpty?: boolean;
  191. removeEmptyAttrs?: boolean;
  192. paddInEmptyBlock?: boolean;
  193. }
  194. interface SchemaElement extends ElementRule {
  195. outputName?: string;
  196. parentsRequired?: string[];
  197. pattern?: RegExp;
  198. }
  199. interface SchemaMap {
  200. [name: string]: {};
  201. }
  202. interface SchemaRegExpMap {
  203. [name: string]: RegExp;
  204. }
  205. interface Schema {
  206. type: SchemaType;
  207. children: Record<string, SchemaMap>;
  208. elements: Record<string, SchemaElement>;
  209. getValidStyles: () => Record<string, string[]> | undefined;
  210. getValidClasses: () => Record<string, SchemaMap> | undefined;
  211. getBlockElements: () => SchemaMap;
  212. getInvalidStyles: () => Record<string, SchemaMap> | undefined;
  213. getVoidElements: () => SchemaMap;
  214. getTextBlockElements: () => SchemaMap;
  215. getTextInlineElements: () => SchemaMap;
  216. getBoolAttrs: () => SchemaMap;
  217. getElementRule: (name: string) => SchemaElement | undefined;
  218. getSelfClosingElements: () => SchemaMap;
  219. getNonEmptyElements: () => SchemaMap;
  220. getMoveCaretBeforeOnEnterElements: () => SchemaMap;
  221. getWhitespaceElements: () => SchemaMap;
  222. getTransparentElements: () => SchemaMap;
  223. getSpecialElements: () => SchemaRegExpMap;
  224. isValidChild: (name: string, child: string) => boolean;
  225. isValid: (name: string, attr?: string) => boolean;
  226. getCustomElements: () => SchemaMap;
  227. addValidElements: (validElements: string) => void;
  228. setValidElements: (validElements: string) => void;
  229. addCustomElements: (customElements: string) => void;
  230. addValidChildren: (validChildren: any) => void;
  231. }
  232. declare type Attributes$1 = Array<{
  233. name: string;
  234. value: string;
  235. }> & {
  236. map: Record<string, string>;
  237. };
  238. interface AstNodeConstructor {
  239. readonly prototype: AstNode;
  240. new (name: string, type: number): AstNode;
  241. create(name: string, attrs?: Record<string, string>): AstNode;
  242. }
  243. declare class AstNode {
  244. static create(name: string, attrs?: Record<string, string>): AstNode;
  245. name: string;
  246. type: number;
  247. attributes?: Attributes$1;
  248. value?: string;
  249. parent?: AstNode | null;
  250. firstChild?: AstNode | null;
  251. lastChild?: AstNode | null;
  252. next?: AstNode | null;
  253. prev?: AstNode | null;
  254. raw?: boolean;
  255. constructor(name: string, type: number);
  256. replace(node: AstNode): AstNode;
  257. attr(name: string, value: string | null | undefined): AstNode | undefined;
  258. attr(name: Record<string, string | null | undefined> | undefined): AstNode | undefined;
  259. attr(name: string): string | undefined;
  260. clone(): AstNode;
  261. wrap(wrapper: AstNode): AstNode;
  262. unwrap(): void;
  263. remove(): AstNode;
  264. append(node: AstNode): AstNode;
  265. insert(node: AstNode, refNode: AstNode, before?: boolean): AstNode;
  266. getAll(name: string): AstNode[];
  267. children(): AstNode[];
  268. empty(): AstNode;
  269. isEmpty(elements: SchemaMap, whitespace?: SchemaMap, predicate?: (node: AstNode) => boolean): boolean;
  270. walk(prev?: boolean): AstNode | null | undefined;
  271. }
  272. declare type Content = string | AstNode;
  273. declare type ContentFormat = 'raw' | 'text' | 'html' | 'tree';
  274. interface GetContentArgs {
  275. format: ContentFormat;
  276. get: boolean;
  277. getInner: boolean;
  278. no_events?: boolean;
  279. save?: boolean;
  280. source_view?: boolean;
  281. [key: string]: any;
  282. }
  283. interface SetContentArgs {
  284. format: string;
  285. set: boolean;
  286. content: Content;
  287. no_events?: boolean;
  288. no_selection?: boolean;
  289. paste?: boolean;
  290. load?: boolean;
  291. initial?: boolean;
  292. [key: string]: any;
  293. }
  294. interface GetSelectionContentArgs extends GetContentArgs {
  295. selection?: boolean;
  296. contextual?: boolean;
  297. }
  298. interface SetSelectionContentArgs extends SetContentArgs {
  299. content: string;
  300. selection?: boolean;
  301. }
  302. interface BlobInfoData {
  303. id?: string;
  304. name?: string;
  305. filename?: string;
  306. blob: Blob;
  307. base64: string;
  308. blobUri?: string;
  309. uri?: string;
  310. }
  311. interface BlobInfo {
  312. id: () => string;
  313. name: () => string;
  314. filename: () => string;
  315. blob: () => Blob;
  316. base64: () => string;
  317. blobUri: () => string;
  318. uri: () => string | undefined;
  319. }
  320. interface BlobCache {
  321. create: {
  322. (o: BlobInfoData): BlobInfo;
  323. (id: string, blob: Blob, base64: string, name?: string, filename?: string): BlobInfo;
  324. };
  325. add: (blobInfo: BlobInfo) => void;
  326. get: (id: string) => BlobInfo | undefined;
  327. getByUri: (blobUri: string) => BlobInfo | undefined;
  328. getByData: (base64: string, type: string) => BlobInfo | undefined;
  329. findFirst: (predicate: (blobInfo: BlobInfo) => boolean) => BlobInfo | undefined;
  330. removeByUri: (blobUri: string) => void;
  331. destroy: () => void;
  332. }
  333. interface BlobInfoImagePair {
  334. image: HTMLImageElement;
  335. blobInfo: BlobInfo;
  336. }
  337. declare class NodeChange {
  338. private readonly editor;
  339. private lastPath;
  340. constructor(editor: Editor);
  341. nodeChanged(args?: Record<string, any>): void;
  342. private isSameElementPath;
  343. }
  344. interface SelectionOverrides {
  345. showCaret: (direction: number, node: HTMLElement, before: boolean, scrollIntoView?: boolean) => Range | null;
  346. showBlockCaretContainer: (blockCaretContainer: HTMLElement) => void;
  347. hideFakeCaret: () => void;
  348. destroy: () => void;
  349. }
  350. interface Quirks {
  351. refreshContentEditable(): void;
  352. isHidden(): boolean;
  353. }
  354. declare type DecoratorData = Record<string, any>;
  355. declare type Decorator = (uid: string, data: DecoratorData) => {
  356. attributes?: {};
  357. classes?: string[];
  358. };
  359. declare type AnnotationListener = (state: boolean, name: string, data?: {
  360. uid: string;
  361. nodes: any[];
  362. }) => void;
  363. declare type AnnotationListenerApi = AnnotationListener;
  364. interface AnnotatorSettings {
  365. decorate: Decorator;
  366. persistent?: boolean;
  367. }
  368. interface Annotator {
  369. register: (name: string, settings: AnnotatorSettings) => void;
  370. annotate: (name: string, data: DecoratorData) => void;
  371. annotationChanged: (name: string, f: AnnotationListenerApi) => void;
  372. remove: (name: string) => void;
  373. removeAll: (name: string) => void;
  374. getAll: (name: string) => Record<string, Element[]>;
  375. }
  376. interface GeomRect {
  377. readonly x: number;
  378. readonly y: number;
  379. readonly w: number;
  380. readonly h: number;
  381. }
  382. interface Rect {
  383. inflate: (rect: GeomRect, w: number, h: number) => GeomRect;
  384. relativePosition: (rect: GeomRect, targetRect: GeomRect, rel: string) => GeomRect;
  385. findBestRelativePosition: (rect: GeomRect, targetRect: GeomRect, constrainRect: GeomRect, rels: string[]) => string | null;
  386. intersect: (rect: GeomRect, cropRect: GeomRect) => GeomRect | null;
  387. clamp: (rect: GeomRect, clampRect: GeomRect, fixedSize?: boolean) => GeomRect;
  388. create: (x: number, y: number, w: number, h: number) => GeomRect;
  389. fromClientRect: (clientRect: DOMRect) => GeomRect;
  390. }
  391. interface NotificationManagerImpl {
  392. open: (spec: NotificationSpec, closeCallback: () => void) => NotificationApi;
  393. close: <T extends NotificationApi>(notification: T) => void;
  394. getArgs: <T extends NotificationApi>(notification: T) => NotificationSpec;
  395. }
  396. interface NotificationSpec {
  397. type?: 'info' | 'warning' | 'error' | 'success';
  398. text: string;
  399. icon?: string;
  400. progressBar?: boolean;
  401. timeout?: number;
  402. closeButton?: boolean;
  403. }
  404. interface NotificationApi {
  405. close: () => void;
  406. progressBar: {
  407. value: (percent: number) => void;
  408. };
  409. text: (text: string) => void;
  410. reposition: () => void;
  411. getEl: () => HTMLElement;
  412. settings: NotificationSpec;
  413. }
  414. interface NotificationManager {
  415. open: (spec: NotificationSpec) => NotificationApi;
  416. close: () => void;
  417. getNotifications: () => NotificationApi[];
  418. }
  419. interface UploadFailure {
  420. message: string;
  421. remove?: boolean;
  422. }
  423. declare type ProgressFn = (percent: number) => void;
  424. declare type UploadHandler = (blobInfo: BlobInfo, progress: ProgressFn) => Promise<string>;
  425. interface UploadResult$2 {
  426. url: string;
  427. blobInfo: BlobInfo;
  428. status: boolean;
  429. error?: UploadFailure;
  430. }
  431. interface RawPattern {
  432. start?: any;
  433. end?: any;
  434. format?: any;
  435. cmd?: any;
  436. value?: any;
  437. replacement?: any;
  438. }
  439. interface InlineBasePattern {
  440. readonly start: string;
  441. readonly end: string;
  442. }
  443. interface InlineFormatPattern extends InlineBasePattern {
  444. readonly type: 'inline-format';
  445. readonly format: string[];
  446. }
  447. interface InlineCmdPattern extends InlineBasePattern {
  448. readonly type: 'inline-command';
  449. readonly cmd: string;
  450. readonly value?: any;
  451. }
  452. declare type InlinePattern = InlineFormatPattern | InlineCmdPattern;
  453. interface BlockBasePattern {
  454. readonly start: string;
  455. }
  456. interface BlockFormatPattern extends BlockBasePattern {
  457. readonly type: 'block-format';
  458. readonly format: string;
  459. }
  460. interface BlockCmdPattern extends BlockBasePattern {
  461. readonly type: 'block-command';
  462. readonly cmd: string;
  463. readonly value?: any;
  464. }
  465. declare type BlockPattern = BlockFormatPattern | BlockCmdPattern;
  466. declare type Pattern = InlinePattern | BlockPattern;
  467. interface DynamicPatternContext {
  468. readonly text: string;
  469. readonly block: Element;
  470. }
  471. declare type DynamicPatternsLookup = (ctx: DynamicPatternContext) => Pattern[];
  472. declare type RawDynamicPatternsLookup = (ctx: DynamicPatternContext) => RawPattern[];
  473. interface AlertBannerSpec {
  474. type: 'alertbanner';
  475. level: 'info' | 'warn' | 'error' | 'success';
  476. text: string;
  477. icon: string;
  478. url?: string;
  479. }
  480. interface ButtonSpec {
  481. type: 'button';
  482. text: string;
  483. enabled?: boolean;
  484. primary?: boolean;
  485. name?: string;
  486. icon?: string;
  487. borderless?: boolean;
  488. buttonType?: 'primary' | 'secondary' | 'toolbar';
  489. }
  490. interface FormComponentSpec {
  491. type: string;
  492. name: string;
  493. }
  494. interface FormComponentWithLabelSpec extends FormComponentSpec {
  495. label?: string;
  496. }
  497. interface CheckboxSpec extends FormComponentSpec {
  498. type: 'checkbox';
  499. label: string;
  500. enabled?: boolean;
  501. }
  502. interface CollectionSpec extends FormComponentWithLabelSpec {
  503. type: 'collection';
  504. }
  505. interface CollectionItem {
  506. value: string;
  507. text: string;
  508. icon: string;
  509. }
  510. interface ColorInputSpec extends FormComponentWithLabelSpec {
  511. type: 'colorinput';
  512. storageKey?: string;
  513. }
  514. interface ColorPickerSpec extends FormComponentWithLabelSpec {
  515. type: 'colorpicker';
  516. }
  517. interface CustomEditorInit {
  518. setValue: (value: string) => void;
  519. getValue: () => string;
  520. destroy: () => void;
  521. }
  522. declare type CustomEditorInitFn = (elm: HTMLElement, settings: any) => Promise<CustomEditorInit>;
  523. interface CustomEditorOldSpec extends FormComponentSpec {
  524. type: 'customeditor';
  525. tag?: string;
  526. init: (e: HTMLElement) => Promise<CustomEditorInit>;
  527. }
  528. interface CustomEditorNewSpec extends FormComponentSpec {
  529. type: 'customeditor';
  530. tag?: string;
  531. scriptId: string;
  532. scriptUrl: string;
  533. settings?: any;
  534. }
  535. declare type CustomEditorSpec = CustomEditorOldSpec | CustomEditorNewSpec;
  536. interface DropZoneSpec extends FormComponentWithLabelSpec {
  537. type: 'dropzone';
  538. }
  539. interface GridSpec {
  540. type: 'grid';
  541. columns: number;
  542. items: BodyComponentSpec[];
  543. }
  544. interface HtmlPanelSpec {
  545. type: 'htmlpanel';
  546. html: string;
  547. presets?: 'presentation' | 'document';
  548. }
  549. interface IframeSpec extends FormComponentWithLabelSpec {
  550. type: 'iframe';
  551. sandboxed?: boolean;
  552. transparent?: boolean;
  553. }
  554. interface ImagePreviewSpec extends FormComponentSpec {
  555. type: 'imagepreview';
  556. height?: string;
  557. }
  558. interface InputSpec extends FormComponentWithLabelSpec {
  559. type: 'input';
  560. inputMode?: string;
  561. placeholder?: string;
  562. maximized?: boolean;
  563. enabled?: boolean;
  564. }
  565. interface LabelSpec {
  566. type: 'label';
  567. label: string;
  568. items: BodyComponentSpec[];
  569. }
  570. interface ListBoxSingleItemSpec {
  571. text: string;
  572. value: string;
  573. }
  574. interface ListBoxNestedItemSpec {
  575. text: string;
  576. items: ListBoxItemSpec[];
  577. }
  578. declare type ListBoxItemSpec = ListBoxNestedItemSpec | ListBoxSingleItemSpec;
  579. interface ListBoxSpec extends FormComponentWithLabelSpec {
  580. type: 'listbox';
  581. items: ListBoxItemSpec[];
  582. disabled?: boolean;
  583. }
  584. interface PanelSpec {
  585. type: 'panel';
  586. classes?: string[];
  587. items: BodyComponentSpec[];
  588. }
  589. interface SelectBoxItemSpec {
  590. text: string;
  591. value: string;
  592. }
  593. interface SelectBoxSpec extends FormComponentWithLabelSpec {
  594. type: 'selectbox';
  595. items: SelectBoxItemSpec[];
  596. size?: number;
  597. enabled?: boolean;
  598. }
  599. interface SizeInputSpec extends FormComponentWithLabelSpec {
  600. type: 'sizeinput';
  601. constrain?: boolean;
  602. enabled?: boolean;
  603. }
  604. interface SliderSpec extends FormComponentSpec {
  605. type: 'slider';
  606. label: string;
  607. min?: number;
  608. max?: number;
  609. }
  610. interface TableSpec {
  611. type: 'table';
  612. header: string[];
  613. cells: string[][];
  614. }
  615. interface TextAreaSpec extends FormComponentWithLabelSpec {
  616. type: 'textarea';
  617. placeholder?: string;
  618. maximized?: boolean;
  619. enabled?: boolean;
  620. }
  621. interface UrlInputSpec extends FormComponentWithLabelSpec {
  622. type: 'urlinput';
  623. filetype?: 'image' | 'media' | 'file';
  624. enabled?: boolean;
  625. }
  626. interface UrlInputData {
  627. value: string;
  628. meta: {
  629. text?: string;
  630. };
  631. }
  632. declare type BodyComponentSpec = BarSpec | ButtonSpec | CheckboxSpec | TextAreaSpec | InputSpec | ListBoxSpec | SelectBoxSpec | SizeInputSpec | SliderSpec | IframeSpec | HtmlPanelSpec | UrlInputSpec | DropZoneSpec | ColorInputSpec | GridSpec | ColorPickerSpec | ImagePreviewSpec | AlertBannerSpec | CollectionSpec | LabelSpec | TableSpec | PanelSpec | CustomEditorSpec;
  633. interface BarSpec {
  634. type: 'bar';
  635. items: BodyComponentSpec[];
  636. }
  637. interface CommonMenuItemSpec {
  638. enabled?: boolean;
  639. text?: string;
  640. value?: string;
  641. meta?: Record<string, any>;
  642. shortcut?: string;
  643. }
  644. interface CommonMenuItemInstanceApi {
  645. isEnabled: () => boolean;
  646. setEnabled: (state: boolean) => void;
  647. }
  648. interface DialogToggleMenuItemSpec extends CommonMenuItemSpec {
  649. type?: 'togglemenuitem';
  650. name: string;
  651. }
  652. declare type DialogFooterMenuButtonItemSpec = DialogToggleMenuItemSpec;
  653. interface BaseDialogFooterButtonSpec {
  654. name?: string;
  655. align?: 'start' | 'end';
  656. primary?: boolean;
  657. enabled?: boolean;
  658. icon?: string;
  659. buttonType?: 'primary' | 'secondary';
  660. }
  661. interface DialogFooterNormalButtonSpec extends BaseDialogFooterButtonSpec {
  662. type: 'submit' | 'cancel' | 'custom';
  663. text: string;
  664. }
  665. interface DialogFooterMenuButtonSpec extends BaseDialogFooterButtonSpec {
  666. type: 'menu';
  667. text?: string;
  668. tooltip?: string;
  669. icon?: string;
  670. items: DialogFooterMenuButtonItemSpec[];
  671. }
  672. declare type DialogFooterButtonSpec = DialogFooterNormalButtonSpec | DialogFooterMenuButtonSpec;
  673. interface TabSpec {
  674. name?: string;
  675. title: string;
  676. items: BodyComponentSpec[];
  677. }
  678. interface TabPanelSpec {
  679. type: 'tabpanel';
  680. tabs: TabSpec[];
  681. }
  682. declare type DialogDataItem = any;
  683. declare type DialogData = Record<string, DialogDataItem>;
  684. interface DialogInstanceApi<T extends DialogData> {
  685. getData: () => T;
  686. setData: (data: Partial<T>) => void;
  687. setEnabled: (name: string, state: boolean) => void;
  688. focus: (name: string) => void;
  689. showTab: (name: string) => void;
  690. redial: (nu: DialogSpec<T>) => void;
  691. block: (msg: string) => void;
  692. unblock: () => void;
  693. close: () => void;
  694. }
  695. interface DialogActionDetails {
  696. name: string;
  697. value?: any;
  698. }
  699. interface DialogChangeDetails<T> {
  700. name: keyof T;
  701. }
  702. interface DialogTabChangeDetails {
  703. newTabName: string;
  704. oldTabName: string;
  705. }
  706. declare type DialogActionHandler<T extends DialogData> = (api: DialogInstanceApi<T>, details: DialogActionDetails) => void;
  707. declare type DialogChangeHandler<T extends DialogData> = (api: DialogInstanceApi<T>, details: DialogChangeDetails<T>) => void;
  708. declare type DialogSubmitHandler<T extends DialogData> = (api: DialogInstanceApi<T>) => void;
  709. declare type DialogCloseHandler = () => void;
  710. declare type DialogCancelHandler<T extends DialogData> = (api: DialogInstanceApi<T>) => void;
  711. declare type DialogTabChangeHandler<T extends DialogData> = (api: DialogInstanceApi<T>, details: DialogTabChangeDetails) => void;
  712. declare type DialogSize = 'normal' | 'medium' | 'large';
  713. interface DialogSpec<T extends DialogData> {
  714. title: string;
  715. size?: DialogSize;
  716. body: TabPanelSpec | PanelSpec;
  717. buttons: DialogFooterButtonSpec[];
  718. initialData?: Partial<T>;
  719. onAction?: DialogActionHandler<T>;
  720. onChange?: DialogChangeHandler<T>;
  721. onSubmit?: DialogSubmitHandler<T>;
  722. onClose?: DialogCloseHandler;
  723. onCancel?: DialogCancelHandler<T>;
  724. onTabChange?: DialogTabChangeHandler<T>;
  725. }
  726. interface UrlDialogInstanceApi {
  727. block: (msg: string) => void;
  728. unblock: () => void;
  729. close: () => void;
  730. sendMessage: (msg: any) => void;
  731. }
  732. interface UrlDialogActionDetails {
  733. name: string;
  734. value?: any;
  735. }
  736. interface UrlDialogMessage {
  737. mceAction: string;
  738. [key: string]: any;
  739. }
  740. declare type UrlDialogActionHandler = (api: UrlDialogInstanceApi, actions: UrlDialogActionDetails) => void;
  741. declare type UrlDialogCloseHandler = () => void;
  742. declare type UrlDialogCancelHandler = (api: UrlDialogInstanceApi) => void;
  743. declare type UrlDialogMessageHandler = (api: UrlDialogInstanceApi, message: UrlDialogMessage) => void;
  744. interface UrlDialogFooterButtonSpec extends DialogFooterNormalButtonSpec {
  745. type: 'cancel' | 'custom';
  746. }
  747. interface UrlDialogSpec {
  748. title: string;
  749. url: string;
  750. height?: number;
  751. width?: number;
  752. buttons?: UrlDialogFooterButtonSpec[];
  753. onAction?: UrlDialogActionHandler;
  754. onClose?: UrlDialogCloseHandler;
  755. onCancel?: UrlDialogCancelHandler;
  756. onMessage?: UrlDialogMessageHandler;
  757. }
  758. declare type CardContainerDirection = 'vertical' | 'horizontal';
  759. declare type CardContainerAlign = 'left' | 'right';
  760. declare type CardContainerValign = 'top' | 'middle' | 'bottom';
  761. interface CardContainerSpec {
  762. type: 'cardcontainer';
  763. items: CardItemSpec[];
  764. direction?: CardContainerDirection;
  765. align?: CardContainerAlign;
  766. valign?: CardContainerValign;
  767. }
  768. interface CardImageSpec {
  769. type: 'cardimage';
  770. src: string;
  771. alt?: string;
  772. classes?: string[];
  773. }
  774. interface CardTextSpec {
  775. type: 'cardtext';
  776. text: string;
  777. name?: string;
  778. classes?: string[];
  779. }
  780. declare type CardItemSpec = CardContainerSpec | CardImageSpec | CardTextSpec;
  781. interface CardMenuItemInstanceApi extends CommonMenuItemInstanceApi {
  782. }
  783. interface CardMenuItemSpec extends Omit<CommonMenuItemSpec, 'text' | 'shortcut'> {
  784. type: 'cardmenuitem';
  785. label?: string;
  786. items: CardItemSpec[];
  787. onSetup?: (api: CardMenuItemInstanceApi) => (api: CardMenuItemInstanceApi) => void;
  788. onAction?: (api: CardMenuItemInstanceApi) => void;
  789. }
  790. interface SeparatorMenuItemSpec {
  791. type?: 'separator';
  792. text?: string;
  793. }
  794. declare type ColumnTypes$1 = number | 'auto';
  795. declare type SeparatorItemSpec = SeparatorMenuItemSpec;
  796. interface AutocompleterItemSpec {
  797. type?: 'autocompleteitem';
  798. value: string;
  799. text?: string;
  800. icon?: string;
  801. meta?: Record<string, any>;
  802. }
  803. declare type AutocompleterContents = SeparatorItemSpec | AutocompleterItemSpec | CardMenuItemSpec;
  804. interface AutocompleterSpec {
  805. type?: 'autocompleter';
  806. ch?: string;
  807. trigger?: string;
  808. minChars?: number;
  809. columns?: ColumnTypes$1;
  810. matches?: (rng: Range, text: string, pattern: string) => boolean;
  811. fetch: (pattern: string, maxResults: number, fetchOptions: Record<string, any>) => Promise<AutocompleterContents[]>;
  812. onAction: (autocompleterApi: AutocompleterInstanceApi, rng: Range, value: string, meta: Record<string, any>) => void;
  813. maxResults?: number;
  814. highlightOn?: string[];
  815. }
  816. interface AutocompleterInstanceApi {
  817. hide: () => void;
  818. reload: (fetchOptions: Record<string, any>) => void;
  819. }
  820. declare type ContextPosition = 'node' | 'selection' | 'line';
  821. declare type ContextScope = 'node' | 'editor';
  822. interface ContextBarSpec {
  823. predicate?: (elem: Element) => boolean;
  824. position?: ContextPosition;
  825. scope?: ContextScope;
  826. }
  827. interface BaseToolbarButtonSpec<I extends BaseToolbarButtonInstanceApi> {
  828. enabled?: boolean;
  829. tooltip?: string;
  830. icon?: string;
  831. text?: string;
  832. onSetup?: (api: I) => (api: I) => void;
  833. }
  834. interface BaseToolbarButtonInstanceApi {
  835. isEnabled: () => boolean;
  836. setEnabled: (state: boolean) => void;
  837. }
  838. interface ToolbarButtonSpec extends BaseToolbarButtonSpec<ToolbarButtonInstanceApi> {
  839. type?: 'button';
  840. onAction: (api: ToolbarButtonInstanceApi) => void;
  841. }
  842. interface ToolbarButtonInstanceApi extends BaseToolbarButtonInstanceApi {
  843. }
  844. interface BaseToolbarToggleButtonSpec<I extends BaseToolbarButtonInstanceApi> extends BaseToolbarButtonSpec<I> {
  845. active?: boolean;
  846. }
  847. interface BaseToolbarToggleButtonInstanceApi extends BaseToolbarButtonInstanceApi {
  848. isActive: () => boolean;
  849. setActive: (state: boolean) => void;
  850. }
  851. interface ToolbarToggleButtonSpec extends BaseToolbarToggleButtonSpec<ToolbarToggleButtonInstanceApi> {
  852. type?: 'togglebutton';
  853. onAction: (api: ToolbarToggleButtonInstanceApi) => void;
  854. }
  855. interface ToolbarToggleButtonInstanceApi extends BaseToolbarToggleButtonInstanceApi {
  856. }
  857. interface ContextFormLaunchButtonApi extends BaseToolbarButtonSpec<BaseToolbarButtonInstanceApi> {
  858. type: 'contextformbutton';
  859. }
  860. interface ContextFormLaunchToggleButtonSpec extends BaseToolbarToggleButtonSpec<BaseToolbarToggleButtonInstanceApi> {
  861. type: 'contextformtogglebutton';
  862. }
  863. interface ContextFormButtonInstanceApi extends BaseToolbarButtonInstanceApi {
  864. }
  865. interface ContextFormToggleButtonInstanceApi extends BaseToolbarToggleButtonInstanceApi {
  866. }
  867. interface ContextFormButtonSpec extends BaseToolbarButtonSpec<ContextFormButtonInstanceApi> {
  868. type?: 'contextformbutton';
  869. primary?: boolean;
  870. onAction: (formApi: ContextFormInstanceApi, api: ContextFormButtonInstanceApi) => void;
  871. }
  872. interface ContextFormToggleButtonSpec extends BaseToolbarToggleButtonSpec<ContextFormToggleButtonInstanceApi> {
  873. type?: 'contextformtogglebutton';
  874. onAction: (formApi: ContextFormInstanceApi, buttonApi: ContextFormToggleButtonInstanceApi) => void;
  875. primary?: boolean;
  876. }
  877. interface ContextFormInstanceApi {
  878. hide: () => void;
  879. getValue: () => string;
  880. }
  881. interface ContextFormSpec extends ContextBarSpec {
  882. type?: 'contextform';
  883. initValue?: () => string;
  884. label?: string;
  885. launch?: ContextFormLaunchButtonApi | ContextFormLaunchToggleButtonSpec;
  886. commands: Array<ContextFormToggleButtonSpec | ContextFormButtonSpec>;
  887. }
  888. interface ContextToolbarSpec extends ContextBarSpec {
  889. type?: 'contexttoolbar';
  890. items: string;
  891. }
  892. interface ChoiceMenuItemSpec extends CommonMenuItemSpec {
  893. type?: 'choiceitem';
  894. icon?: string;
  895. }
  896. interface ChoiceMenuItemInstanceApi extends CommonMenuItemInstanceApi {
  897. isActive: () => boolean;
  898. setActive: (state: boolean) => void;
  899. }
  900. interface ContextMenuItem extends CommonMenuItemSpec {
  901. text: string;
  902. icon?: string;
  903. type?: 'item';
  904. onAction: () => void;
  905. }
  906. interface ContextSubMenu extends CommonMenuItemSpec {
  907. type: 'submenu';
  908. text: string;
  909. icon?: string;
  910. getSubmenuItems: () => string | Array<ContextMenuContents>;
  911. }
  912. declare type ContextMenuContents = string | ContextMenuItem | SeparatorMenuItemSpec | ContextSubMenu;
  913. interface ContextMenuApi {
  914. update: (element: Element) => string | Array<ContextMenuContents>;
  915. }
  916. interface FancyActionArgsMap {
  917. 'inserttable': {
  918. numRows: number;
  919. numColumns: number;
  920. };
  921. 'colorswatch': {
  922. value: string;
  923. };
  924. }
  925. interface BaseFancyMenuItemSpec<T extends keyof FancyActionArgsMap> {
  926. type: 'fancymenuitem';
  927. fancytype: T;
  928. initData?: Record<string, unknown>;
  929. onAction?: (data: FancyActionArgsMap[T]) => void;
  930. }
  931. interface InsertTableMenuItemSpec extends BaseFancyMenuItemSpec<'inserttable'> {
  932. fancytype: 'inserttable';
  933. initData?: {};
  934. }
  935. interface ColorSwatchMenuItemSpec extends BaseFancyMenuItemSpec<'colorswatch'> {
  936. fancytype: 'colorswatch';
  937. initData?: {
  938. allowCustomColors?: boolean;
  939. colors?: ChoiceMenuItemSpec[];
  940. storageKey?: string;
  941. };
  942. }
  943. declare type FancyMenuItemSpec = InsertTableMenuItemSpec | ColorSwatchMenuItemSpec;
  944. interface MenuItemSpec extends CommonMenuItemSpec {
  945. type?: 'menuitem';
  946. icon?: string;
  947. onSetup?: (api: MenuItemInstanceApi) => (api: MenuItemInstanceApi) => void;
  948. onAction?: (api: MenuItemInstanceApi) => void;
  949. }
  950. interface MenuItemInstanceApi extends CommonMenuItemInstanceApi {
  951. }
  952. declare type NestedMenuItemContents = string | MenuItemSpec | NestedMenuItemSpec | ToggleMenuItemSpec | SeparatorMenuItemSpec | FancyMenuItemSpec;
  953. interface NestedMenuItemSpec extends CommonMenuItemSpec {
  954. type?: 'nestedmenuitem';
  955. icon?: string;
  956. getSubmenuItems: () => string | Array<NestedMenuItemContents>;
  957. onSetup?: (api: NestedMenuItemInstanceApi) => (api: NestedMenuItemInstanceApi) => void;
  958. }
  959. interface NestedMenuItemInstanceApi extends CommonMenuItemInstanceApi {
  960. }
  961. interface ToggleMenuItemSpec extends CommonMenuItemSpec {
  962. type?: 'togglemenuitem';
  963. icon?: string;
  964. active?: boolean;
  965. onSetup?: (api: ToggleMenuItemInstanceApi) => void;
  966. onAction: (api: ToggleMenuItemInstanceApi) => void;
  967. }
  968. interface ToggleMenuItemInstanceApi extends CommonMenuItemInstanceApi {
  969. isActive: () => boolean;
  970. setActive: (state: boolean) => void;
  971. }
  972. type PublicDialog_d_AlertBannerSpec = AlertBannerSpec;
  973. type PublicDialog_d_BarSpec = BarSpec;
  974. type PublicDialog_d_BodyComponentSpec = BodyComponentSpec;
  975. type PublicDialog_d_ButtonSpec = ButtonSpec;
  976. type PublicDialog_d_CheckboxSpec = CheckboxSpec;
  977. type PublicDialog_d_CollectionItem = CollectionItem;
  978. type PublicDialog_d_CollectionSpec = CollectionSpec;
  979. type PublicDialog_d_ColorInputSpec = ColorInputSpec;
  980. type PublicDialog_d_ColorPickerSpec = ColorPickerSpec;
  981. type PublicDialog_d_CustomEditorSpec = CustomEditorSpec;
  982. type PublicDialog_d_CustomEditorInit = CustomEditorInit;
  983. type PublicDialog_d_CustomEditorInitFn = CustomEditorInitFn;
  984. type PublicDialog_d_DialogData = DialogData;
  985. type PublicDialog_d_DialogSize = DialogSize;
  986. type PublicDialog_d_DialogSpec<T extends DialogData> = DialogSpec<T>;
  987. type PublicDialog_d_DialogInstanceApi<T extends DialogData> = DialogInstanceApi<T>;
  988. type PublicDialog_d_DialogFooterButtonSpec = DialogFooterButtonSpec;
  989. type PublicDialog_d_DialogActionDetails = DialogActionDetails;
  990. type PublicDialog_d_DialogChangeDetails<T> = DialogChangeDetails<T>;
  991. type PublicDialog_d_DialogTabChangeDetails = DialogTabChangeDetails;
  992. type PublicDialog_d_DropZoneSpec = DropZoneSpec;
  993. type PublicDialog_d_GridSpec = GridSpec;
  994. type PublicDialog_d_HtmlPanelSpec = HtmlPanelSpec;
  995. type PublicDialog_d_IframeSpec = IframeSpec;
  996. type PublicDialog_d_ImagePreviewSpec = ImagePreviewSpec;
  997. type PublicDialog_d_InputSpec = InputSpec;
  998. type PublicDialog_d_LabelSpec = LabelSpec;
  999. type PublicDialog_d_ListBoxSpec = ListBoxSpec;
  1000. type PublicDialog_d_ListBoxItemSpec = ListBoxItemSpec;
  1001. type PublicDialog_d_ListBoxNestedItemSpec = ListBoxNestedItemSpec;
  1002. type PublicDialog_d_ListBoxSingleItemSpec = ListBoxSingleItemSpec;
  1003. type PublicDialog_d_PanelSpec = PanelSpec;
  1004. type PublicDialog_d_SelectBoxSpec = SelectBoxSpec;
  1005. type PublicDialog_d_SelectBoxItemSpec = SelectBoxItemSpec;
  1006. type PublicDialog_d_SizeInputSpec = SizeInputSpec;
  1007. type PublicDialog_d_SliderSpec = SliderSpec;
  1008. type PublicDialog_d_TableSpec = TableSpec;
  1009. type PublicDialog_d_TabSpec = TabSpec;
  1010. type PublicDialog_d_TabPanelSpec = TabPanelSpec;
  1011. type PublicDialog_d_TextAreaSpec = TextAreaSpec;
  1012. type PublicDialog_d_UrlInputData = UrlInputData;
  1013. type PublicDialog_d_UrlInputSpec = UrlInputSpec;
  1014. type PublicDialog_d_UrlDialogSpec = UrlDialogSpec;
  1015. type PublicDialog_d_UrlDialogFooterButtonSpec = UrlDialogFooterButtonSpec;
  1016. type PublicDialog_d_UrlDialogInstanceApi = UrlDialogInstanceApi;
  1017. type PublicDialog_d_UrlDialogActionDetails = UrlDialogActionDetails;
  1018. type PublicDialog_d_UrlDialogMessage = UrlDialogMessage;
  1019. declare namespace PublicDialog_d {
  1020. export { PublicDialog_d_AlertBannerSpec as AlertBannerSpec, PublicDialog_d_BarSpec as BarSpec, PublicDialog_d_BodyComponentSpec as BodyComponentSpec, PublicDialog_d_ButtonSpec as ButtonSpec, PublicDialog_d_CheckboxSpec as CheckboxSpec, PublicDialog_d_CollectionItem as CollectionItem, PublicDialog_d_CollectionSpec as CollectionSpec, PublicDialog_d_ColorInputSpec as ColorInputSpec, PublicDialog_d_ColorPickerSpec as ColorPickerSpec, PublicDialog_d_CustomEditorSpec as CustomEditorSpec, PublicDialog_d_CustomEditorInit as CustomEditorInit, PublicDialog_d_CustomEditorInitFn as CustomEditorInitFn, PublicDialog_d_DialogData as DialogData, PublicDialog_d_DialogSize as DialogSize, PublicDialog_d_DialogSpec as DialogSpec, PublicDialog_d_DialogInstanceApi as DialogInstanceApi, PublicDialog_d_DialogFooterButtonSpec as DialogFooterButtonSpec, PublicDialog_d_DialogActionDetails as DialogActionDetails, PublicDialog_d_DialogChangeDetails as DialogChangeDetails, PublicDialog_d_DialogTabChangeDetails as DialogTabChangeDetails, PublicDialog_d_DropZoneSpec as DropZoneSpec, PublicDialog_d_GridSpec as GridSpec, PublicDialog_d_HtmlPanelSpec as HtmlPanelSpec, PublicDialog_d_IframeSpec as IframeSpec, PublicDialog_d_ImagePreviewSpec as ImagePreviewSpec, PublicDialog_d_InputSpec as InputSpec, PublicDialog_d_LabelSpec as LabelSpec, PublicDialog_d_ListBoxSpec as ListBoxSpec, PublicDialog_d_ListBoxItemSpec as ListBoxItemSpec, PublicDialog_d_ListBoxNestedItemSpec as ListBoxNestedItemSpec, PublicDialog_d_ListBoxSingleItemSpec as ListBoxSingleItemSpec, PublicDialog_d_PanelSpec as PanelSpec, PublicDialog_d_SelectBoxSpec as SelectBoxSpec, PublicDialog_d_SelectBoxItemSpec as SelectBoxItemSpec, PublicDialog_d_SizeInputSpec as SizeInputSpec, PublicDialog_d_SliderSpec as SliderSpec, PublicDialog_d_TableSpec as TableSpec, PublicDialog_d_TabSpec as TabSpec, PublicDialog_d_TabPanelSpec as TabPanelSpec, PublicDialog_d_TextAreaSpec as TextAreaSpec, PublicDialog_d_UrlInputData as UrlInputData, PublicDialog_d_UrlInputSpec as UrlInputSpec, PublicDialog_d_UrlDialogSpec as UrlDialogSpec, PublicDialog_d_UrlDialogFooterButtonSpec as UrlDialogFooterButtonSpec, PublicDialog_d_UrlDialogInstanceApi as UrlDialogInstanceApi, PublicDialog_d_UrlDialogActionDetails as UrlDialogActionDetails, PublicDialog_d_UrlDialogMessage as UrlDialogMessage, };
  1021. }
  1022. type PublicInlineContent_d_AutocompleterSpec = AutocompleterSpec;
  1023. type PublicInlineContent_d_AutocompleterItemSpec = AutocompleterItemSpec;
  1024. type PublicInlineContent_d_AutocompleterContents = AutocompleterContents;
  1025. type PublicInlineContent_d_AutocompleterInstanceApi = AutocompleterInstanceApi;
  1026. type PublicInlineContent_d_ContextPosition = ContextPosition;
  1027. type PublicInlineContent_d_ContextScope = ContextScope;
  1028. type PublicInlineContent_d_ContextFormSpec = ContextFormSpec;
  1029. type PublicInlineContent_d_ContextFormInstanceApi = ContextFormInstanceApi;
  1030. type PublicInlineContent_d_ContextFormButtonSpec = ContextFormButtonSpec;
  1031. type PublicInlineContent_d_ContextFormButtonInstanceApi = ContextFormButtonInstanceApi;
  1032. type PublicInlineContent_d_ContextFormToggleButtonSpec = ContextFormToggleButtonSpec;
  1033. type PublicInlineContent_d_ContextFormToggleButtonInstanceApi = ContextFormToggleButtonInstanceApi;
  1034. type PublicInlineContent_d_ContextToolbarSpec = ContextToolbarSpec;
  1035. type PublicInlineContent_d_SeparatorItemSpec = SeparatorItemSpec;
  1036. declare namespace PublicInlineContent_d {
  1037. export { PublicInlineContent_d_AutocompleterSpec as AutocompleterSpec, PublicInlineContent_d_AutocompleterItemSpec as AutocompleterItemSpec, PublicInlineContent_d_AutocompleterContents as AutocompleterContents, PublicInlineContent_d_AutocompleterInstanceApi as AutocompleterInstanceApi, PublicInlineContent_d_ContextPosition as ContextPosition, PublicInlineContent_d_ContextScope as ContextScope, PublicInlineContent_d_ContextFormSpec as ContextFormSpec, PublicInlineContent_d_ContextFormInstanceApi as ContextFormInstanceApi, PublicInlineContent_d_ContextFormButtonSpec as ContextFormButtonSpec, PublicInlineContent_d_ContextFormButtonInstanceApi as ContextFormButtonInstanceApi, PublicInlineContent_d_ContextFormToggleButtonSpec as ContextFormToggleButtonSpec, PublicInlineContent_d_ContextFormToggleButtonInstanceApi as ContextFormToggleButtonInstanceApi, PublicInlineContent_d_ContextToolbarSpec as ContextToolbarSpec, PublicInlineContent_d_SeparatorItemSpec as SeparatorItemSpec, };
  1038. }
  1039. type PublicMenu_d_MenuItemSpec = MenuItemSpec;
  1040. type PublicMenu_d_MenuItemInstanceApi = MenuItemInstanceApi;
  1041. type PublicMenu_d_NestedMenuItemContents = NestedMenuItemContents;
  1042. type PublicMenu_d_NestedMenuItemSpec = NestedMenuItemSpec;
  1043. type PublicMenu_d_NestedMenuItemInstanceApi = NestedMenuItemInstanceApi;
  1044. type PublicMenu_d_FancyMenuItemSpec = FancyMenuItemSpec;
  1045. type PublicMenu_d_ColorSwatchMenuItemSpec = ColorSwatchMenuItemSpec;
  1046. type PublicMenu_d_InsertTableMenuItemSpec = InsertTableMenuItemSpec;
  1047. type PublicMenu_d_ToggleMenuItemSpec = ToggleMenuItemSpec;
  1048. type PublicMenu_d_ToggleMenuItemInstanceApi = ToggleMenuItemInstanceApi;
  1049. type PublicMenu_d_ChoiceMenuItemSpec = ChoiceMenuItemSpec;
  1050. type PublicMenu_d_ChoiceMenuItemInstanceApi = ChoiceMenuItemInstanceApi;
  1051. type PublicMenu_d_SeparatorMenuItemSpec = SeparatorMenuItemSpec;
  1052. type PublicMenu_d_ContextMenuApi = ContextMenuApi;
  1053. type PublicMenu_d_ContextMenuContents = ContextMenuContents;
  1054. type PublicMenu_d_ContextMenuItem = ContextMenuItem;
  1055. type PublicMenu_d_ContextSubMenu = ContextSubMenu;
  1056. type PublicMenu_d_CardMenuItemSpec = CardMenuItemSpec;
  1057. type PublicMenu_d_CardMenuItemInstanceApi = CardMenuItemInstanceApi;
  1058. type PublicMenu_d_CardItemSpec = CardItemSpec;
  1059. type PublicMenu_d_CardContainerSpec = CardContainerSpec;
  1060. type PublicMenu_d_CardImageSpec = CardImageSpec;
  1061. type PublicMenu_d_CardTextSpec = CardTextSpec;
  1062. declare namespace PublicMenu_d {
  1063. export { PublicMenu_d_MenuItemSpec as MenuItemSpec, PublicMenu_d_MenuItemInstanceApi as MenuItemInstanceApi, PublicMenu_d_NestedMenuItemContents as NestedMenuItemContents, PublicMenu_d_NestedMenuItemSpec as NestedMenuItemSpec, PublicMenu_d_NestedMenuItemInstanceApi as NestedMenuItemInstanceApi, PublicMenu_d_FancyMenuItemSpec as FancyMenuItemSpec, PublicMenu_d_ColorSwatchMenuItemSpec as ColorSwatchMenuItemSpec, PublicMenu_d_InsertTableMenuItemSpec as InsertTableMenuItemSpec, PublicMenu_d_ToggleMenuItemSpec as ToggleMenuItemSpec, PublicMenu_d_ToggleMenuItemInstanceApi as ToggleMenuItemInstanceApi, PublicMenu_d_ChoiceMenuItemSpec as ChoiceMenuItemSpec, PublicMenu_d_ChoiceMenuItemInstanceApi as ChoiceMenuItemInstanceApi, PublicMenu_d_SeparatorMenuItemSpec as SeparatorMenuItemSpec, PublicMenu_d_ContextMenuApi as ContextMenuApi, PublicMenu_d_ContextMenuContents as ContextMenuContents, PublicMenu_d_ContextMenuItem as ContextMenuItem, PublicMenu_d_ContextSubMenu as ContextSubMenu, PublicMenu_d_CardMenuItemSpec as CardMenuItemSpec, PublicMenu_d_CardMenuItemInstanceApi as CardMenuItemInstanceApi, PublicMenu_d_CardItemSpec as CardItemSpec, PublicMenu_d_CardContainerSpec as CardContainerSpec, PublicMenu_d_CardImageSpec as CardImageSpec, PublicMenu_d_CardTextSpec as CardTextSpec, };
  1064. }
  1065. interface SidebarInstanceApi {
  1066. element: () => HTMLElement;
  1067. }
  1068. interface SidebarSpec {
  1069. icon?: string;
  1070. tooltip?: string;
  1071. onShow?: (api: SidebarInstanceApi) => void;
  1072. onSetup?: (api: SidebarInstanceApi) => (api: SidebarInstanceApi) => void;
  1073. onHide?: (api: SidebarInstanceApi) => void;
  1074. }
  1075. type PublicSidebar_d_SidebarSpec = SidebarSpec;
  1076. type PublicSidebar_d_SidebarInstanceApi = SidebarInstanceApi;
  1077. declare namespace PublicSidebar_d {
  1078. export { PublicSidebar_d_SidebarSpec as SidebarSpec, PublicSidebar_d_SidebarInstanceApi as SidebarInstanceApi, };
  1079. }
  1080. interface ToolbarGroupSetting {
  1081. name: string;
  1082. items: string[];
  1083. }
  1084. declare type ToolbarConfig = string | ToolbarGroupSetting[];
  1085. interface GroupToolbarButtonInstanceApi extends BaseToolbarButtonInstanceApi {
  1086. }
  1087. interface GroupToolbarButtonSpec extends BaseToolbarButtonSpec<GroupToolbarButtonInstanceApi> {
  1088. type?: 'grouptoolbarbutton';
  1089. items?: ToolbarConfig;
  1090. }
  1091. declare type MenuButtonItemTypes = NestedMenuItemContents;
  1092. declare type SuccessCallback$1 = (menu: string | MenuButtonItemTypes[]) => void;
  1093. interface MenuButtonFetchContext {
  1094. pattern: string;
  1095. }
  1096. interface BaseMenuButtonSpec {
  1097. text?: string;
  1098. tooltip?: string;
  1099. icon?: string;
  1100. search?: boolean | {
  1101. placeholder?: string;
  1102. };
  1103. fetch: (success: SuccessCallback$1, fetchContext: MenuButtonFetchContext) => void;
  1104. onSetup?: (api: BaseMenuButtonInstanceApi) => (api: BaseMenuButtonInstanceApi) => void;
  1105. }
  1106. interface BaseMenuButtonInstanceApi {
  1107. isEnabled: () => boolean;
  1108. setEnabled: (state: boolean) => void;
  1109. isActive: () => boolean;
  1110. setActive: (state: boolean) => void;
  1111. }
  1112. interface ToolbarMenuButtonSpec extends BaseMenuButtonSpec {
  1113. type?: 'menubutton';
  1114. onSetup?: (api: ToolbarMenuButtonInstanceApi) => (api: ToolbarMenuButtonInstanceApi) => void;
  1115. }
  1116. interface ToolbarMenuButtonInstanceApi extends BaseMenuButtonInstanceApi {
  1117. }
  1118. declare type ToolbarSplitButtonItemTypes = ChoiceMenuItemSpec | SeparatorMenuItemSpec;
  1119. declare type SuccessCallback = (menu: ToolbarSplitButtonItemTypes[]) => void;
  1120. declare type SelectPredicate = (value: string) => boolean;
  1121. declare type PresetTypes = 'color' | 'normal' | 'listpreview';
  1122. declare type ColumnTypes = number | 'auto';
  1123. interface ToolbarSplitButtonSpec {
  1124. type?: 'splitbutton';
  1125. tooltip?: string;
  1126. icon?: string;
  1127. text?: string;
  1128. select?: SelectPredicate;
  1129. presets?: PresetTypes;
  1130. columns?: ColumnTypes;
  1131. fetch: (success: SuccessCallback) => void;
  1132. onSetup?: (api: ToolbarSplitButtonInstanceApi) => (api: ToolbarSplitButtonInstanceApi) => void;
  1133. onAction: (api: ToolbarSplitButtonInstanceApi) => void;
  1134. onItemAction: (api: ToolbarSplitButtonInstanceApi, value: string) => void;
  1135. }
  1136. interface ToolbarSplitButtonInstanceApi {
  1137. isEnabled: () => boolean;
  1138. setEnabled: (state: boolean) => void;
  1139. setIconFill: (id: string, value: string) => void;
  1140. isActive: () => boolean;
  1141. setActive: (state: boolean) => void;
  1142. }
  1143. type PublicToolbar_d_ToolbarButtonSpec = ToolbarButtonSpec;
  1144. type PublicToolbar_d_ToolbarButtonInstanceApi = ToolbarButtonInstanceApi;
  1145. type PublicToolbar_d_ToolbarSplitButtonSpec = ToolbarSplitButtonSpec;
  1146. type PublicToolbar_d_ToolbarSplitButtonInstanceApi = ToolbarSplitButtonInstanceApi;
  1147. type PublicToolbar_d_ToolbarMenuButtonSpec = ToolbarMenuButtonSpec;
  1148. type PublicToolbar_d_ToolbarMenuButtonInstanceApi = ToolbarMenuButtonInstanceApi;
  1149. type PublicToolbar_d_ToolbarToggleButtonSpec = ToolbarToggleButtonSpec;
  1150. type PublicToolbar_d_ToolbarToggleButtonInstanceApi = ToolbarToggleButtonInstanceApi;
  1151. type PublicToolbar_d_GroupToolbarButtonSpec = GroupToolbarButtonSpec;
  1152. type PublicToolbar_d_GroupToolbarButtonInstanceApi = GroupToolbarButtonInstanceApi;
  1153. declare namespace PublicToolbar_d {
  1154. export { PublicToolbar_d_ToolbarButtonSpec as ToolbarButtonSpec, PublicToolbar_d_ToolbarButtonInstanceApi as ToolbarButtonInstanceApi, PublicToolbar_d_ToolbarSplitButtonSpec as ToolbarSplitButtonSpec, PublicToolbar_d_ToolbarSplitButtonInstanceApi as ToolbarSplitButtonInstanceApi, PublicToolbar_d_ToolbarMenuButtonSpec as ToolbarMenuButtonSpec, PublicToolbar_d_ToolbarMenuButtonInstanceApi as ToolbarMenuButtonInstanceApi, PublicToolbar_d_ToolbarToggleButtonSpec as ToolbarToggleButtonSpec, PublicToolbar_d_ToolbarToggleButtonInstanceApi as ToolbarToggleButtonInstanceApi, PublicToolbar_d_GroupToolbarButtonSpec as GroupToolbarButtonSpec, PublicToolbar_d_GroupToolbarButtonInstanceApi as GroupToolbarButtonInstanceApi, };
  1155. }
  1156. interface ViewNormalButtonSpec {
  1157. type: 'button';
  1158. text: string;
  1159. buttonType?: 'primary' | 'secondary';
  1160. onAction: () => void;
  1161. }
  1162. declare type ViewButtonSpec = ViewNormalButtonSpec;
  1163. interface ViewInstanceApi {
  1164. getContainer: () => HTMLElement;
  1165. }
  1166. interface ViewSpec {
  1167. buttons?: ViewButtonSpec[];
  1168. onShow: (api: ViewInstanceApi) => void;
  1169. onHide: (api: ViewInstanceApi) => void;
  1170. }
  1171. type PublicView_d_ViewSpec = ViewSpec;
  1172. type PublicView_d_ViewInstanceApi = ViewInstanceApi;
  1173. declare namespace PublicView_d {
  1174. export { PublicView_d_ViewSpec as ViewSpec, PublicView_d_ViewInstanceApi as ViewInstanceApi, };
  1175. }
  1176. interface Registry$1 {
  1177. addButton: (name: string, spec: ToolbarButtonSpec) => void;
  1178. addGroupToolbarButton: (name: string, spec: GroupToolbarButtonSpec) => void;
  1179. addToggleButton: (name: string, spec: ToolbarToggleButtonSpec) => void;
  1180. addMenuButton: (name: string, spec: ToolbarMenuButtonSpec) => void;
  1181. addSplitButton: (name: string, spec: ToolbarSplitButtonSpec) => void;
  1182. addMenuItem: (name: string, spec: MenuItemSpec) => void;
  1183. addNestedMenuItem: (name: string, spec: NestedMenuItemSpec) => void;
  1184. addToggleMenuItem: (name: string, spec: ToggleMenuItemSpec) => void;
  1185. addContextMenu: (name: string, spec: ContextMenuApi) => void;
  1186. addContextToolbar: (name: string, spec: ContextToolbarSpec) => void;
  1187. addContextForm: (name: string, spec: ContextFormSpec) => void;
  1188. addIcon: (name: string, svgData: string) => void;
  1189. addAutocompleter: (name: string, spec: AutocompleterSpec) => void;
  1190. addSidebar: (name: string, spec: SidebarSpec) => void;
  1191. addView: (name: string, spec: ViewSpec) => void;
  1192. getAll: () => {
  1193. buttons: Record<string, ToolbarButtonSpec | GroupToolbarButtonSpec | ToolbarMenuButtonSpec | ToolbarSplitButtonSpec | ToolbarToggleButtonSpec>;
  1194. menuItems: Record<string, MenuItemSpec | NestedMenuItemSpec | ToggleMenuItemSpec>;
  1195. popups: Record<string, AutocompleterSpec>;
  1196. contextMenus: Record<string, ContextMenuApi>;
  1197. contextToolbars: Record<string, ContextToolbarSpec | ContextFormSpec>;
  1198. icons: Record<string, string>;
  1199. sidebars: Record<string, SidebarSpec>;
  1200. views: Record<string, ViewSpec>;
  1201. };
  1202. }
  1203. interface AutocompleteLookupData {
  1204. readonly matchText: string;
  1205. readonly items: AutocompleterContents[];
  1206. readonly columns: ColumnTypes$1;
  1207. readonly onAction: (autoApi: AutocompleterInstanceApi, rng: Range, value: string, meta: Record<string, any>) => void;
  1208. readonly highlightOn: string[];
  1209. }
  1210. interface AutocompleterEventArgs {
  1211. readonly lookupData: AutocompleteLookupData[];
  1212. }
  1213. interface RangeLikeObject {
  1214. startContainer: Node;
  1215. startOffset: number;
  1216. endContainer: Node;
  1217. endOffset: number;
  1218. }
  1219. declare type ApplyFormat = BlockFormat | InlineFormat | SelectorFormat;
  1220. declare type RemoveFormat = RemoveBlockFormat | RemoveInlineFormat | RemoveSelectorFormat;
  1221. declare type Format = ApplyFormat | RemoveFormat;
  1222. declare type Formats = Record<string, Format | Format[]>;
  1223. declare type FormatAttrOrStyleValue = string | ((vars?: FormatVars) => string | null);
  1224. declare type FormatVars = Record<string, string | null>;
  1225. interface BaseFormat<T> {
  1226. ceFalseOverride?: boolean;
  1227. classes?: string | string[];
  1228. collapsed?: boolean;
  1229. exact?: boolean;
  1230. expand?: boolean;
  1231. links?: boolean;
  1232. mixed?: boolean;
  1233. block_expand?: boolean;
  1234. onmatch?: (node: Element, fmt: T, itemName: string) => boolean;
  1235. remove?: 'none' | 'empty' | 'all';
  1236. remove_similar?: boolean;
  1237. split?: boolean;
  1238. deep?: boolean;
  1239. preserve_attributes?: string[];
  1240. }
  1241. interface Block {
  1242. block: string;
  1243. list_block?: string;
  1244. wrapper?: boolean;
  1245. }
  1246. interface Inline {
  1247. inline: string;
  1248. }
  1249. interface Selector {
  1250. selector: string;
  1251. inherit?: boolean;
  1252. }
  1253. interface CommonFormat<T> extends BaseFormat<T> {
  1254. attributes?: Record<string, FormatAttrOrStyleValue>;
  1255. styles?: Record<string, FormatAttrOrStyleValue>;
  1256. toggle?: boolean;
  1257. preview?: string | false;
  1258. onformat?: (elm: Element, fmt: T, vars?: FormatVars, node?: Node | RangeLikeObject | null) => void;
  1259. clear_child_styles?: boolean;
  1260. merge_siblings?: boolean;
  1261. merge_with_parents?: boolean;
  1262. }
  1263. interface BlockFormat extends Block, CommonFormat<BlockFormat> {
  1264. }
  1265. interface InlineFormat extends Inline, CommonFormat<InlineFormat> {
  1266. }
  1267. interface SelectorFormat extends Selector, CommonFormat<SelectorFormat> {
  1268. }
  1269. interface CommonRemoveFormat<T> extends BaseFormat<T> {
  1270. attributes?: string[] | Record<string, FormatAttrOrStyleValue>;
  1271. styles?: string[] | Record<string, FormatAttrOrStyleValue>;
  1272. }
  1273. interface RemoveBlockFormat extends Block, CommonRemoveFormat<RemoveBlockFormat> {
  1274. }
  1275. interface RemoveInlineFormat extends Inline, CommonRemoveFormat<RemoveInlineFormat> {
  1276. }
  1277. interface RemoveSelectorFormat extends Selector, CommonRemoveFormat<RemoveSelectorFormat> {
  1278. }
  1279. interface Filter<C extends Function> {
  1280. name: string;
  1281. callbacks: C[];
  1282. }
  1283. interface ParserArgs {
  1284. getInner?: boolean | number;
  1285. forced_root_block?: boolean | string;
  1286. context?: string;
  1287. isRootContent?: boolean;
  1288. format?: string;
  1289. invalid?: boolean;
  1290. no_events?: boolean;
  1291. [key: string]: any;
  1292. }
  1293. declare type ParserFilterCallback = (nodes: AstNode[], name: string, args: ParserArgs) => void;
  1294. interface ParserFilter extends Filter<ParserFilterCallback> {
  1295. }
  1296. interface DomParserSettings {
  1297. allow_html_data_urls?: boolean;
  1298. allow_svg_data_urls?: boolean;
  1299. allow_conditional_comments?: boolean;
  1300. allow_html_in_named_anchor?: boolean;
  1301. allow_script_urls?: boolean;
  1302. allow_unsafe_link_target?: boolean;
  1303. convert_fonts_to_spans?: boolean;
  1304. fix_list_elements?: boolean;
  1305. font_size_legacy_values?: string;
  1306. forced_root_block?: boolean | string;
  1307. forced_root_block_attrs?: Record<string, string>;
  1308. preserve_cdata?: boolean;
  1309. remove_trailing_brs?: boolean;
  1310. root_name?: string;
  1311. validate?: boolean;
  1312. inline_styles?: boolean;
  1313. blob_cache?: BlobCache;
  1314. document?: Document;
  1315. }
  1316. interface DomParser {
  1317. schema: Schema;
  1318. addAttributeFilter: (name: string, callback: ParserFilterCallback) => void;
  1319. getAttributeFilters: () => ParserFilter[];
  1320. removeAttributeFilter: (name: string, callback?: ParserFilterCallback) => void;
  1321. addNodeFilter: (name: string, callback: ParserFilterCallback) => void;
  1322. getNodeFilters: () => ParserFilter[];
  1323. removeNodeFilter: (name: string, callback?: ParserFilterCallback) => void;
  1324. parse: (html: string, args?: ParserArgs) => AstNode;
  1325. }
  1326. interface StyleSheetLoaderSettings {
  1327. maxLoadTime?: number;
  1328. contentCssCors?: boolean;
  1329. referrerPolicy?: ReferrerPolicy;
  1330. }
  1331. interface StyleSheetLoader {
  1332. load: (url: string) => Promise<void>;
  1333. loadAll: (urls: string[]) => Promise<string[]>;
  1334. unload: (url: string) => void;
  1335. unloadAll: (urls: string[]) => void;
  1336. _setReferrerPolicy: (referrerPolicy: ReferrerPolicy) => void;
  1337. _setContentCssCors: (contentCssCors: boolean) => void;
  1338. }
  1339. declare type Registry = Registry$1;
  1340. interface EditorUiApi {
  1341. show: () => void;
  1342. hide: () => void;
  1343. setEnabled: (state: boolean) => void;
  1344. isEnabled: () => boolean;
  1345. }
  1346. interface EditorUi extends EditorUiApi {
  1347. registry: Registry;
  1348. styleSheetLoader: StyleSheetLoader;
  1349. }
  1350. type Ui_d_Registry = Registry;
  1351. type Ui_d_EditorUiApi = EditorUiApi;
  1352. type Ui_d_EditorUi = EditorUi;
  1353. declare namespace Ui_d {
  1354. export { Ui_d_Registry as Registry, PublicDialog_d as Dialog, PublicInlineContent_d as InlineContent, PublicMenu_d as Menu, PublicView_d as View, PublicSidebar_d as Sidebar, PublicToolbar_d as Toolbar, Ui_d_EditorUiApi as EditorUiApi, Ui_d_EditorUi as EditorUi, };
  1355. }
  1356. interface WindowParams {
  1357. readonly inline?: 'cursor' | 'toolbar';
  1358. readonly ariaAttrs?: boolean;
  1359. }
  1360. declare type InstanceApi<T extends DialogData> = UrlDialogInstanceApi | DialogInstanceApi<T>;
  1361. interface WindowManagerImpl {
  1362. open: <T extends DialogData>(config: DialogSpec<T>, params: WindowParams | undefined, closeWindow: (dialog: DialogInstanceApi<T>) => void) => DialogInstanceApi<T>;
  1363. openUrl: (config: UrlDialogSpec, closeWindow: (dialog: UrlDialogInstanceApi) => void) => UrlDialogInstanceApi;
  1364. alert: (message: string, callback: () => void) => void;
  1365. confirm: (message: string, callback: (state: boolean) => void) => void;
  1366. close: (dialog: InstanceApi<any>) => void;
  1367. }
  1368. interface WindowManager {
  1369. open: <T extends DialogData>(config: DialogSpec<T>, params?: WindowParams) => DialogInstanceApi<T>;
  1370. openUrl: (config: UrlDialogSpec) => UrlDialogInstanceApi;
  1371. alert: (message: string, callback?: () => void, scope?: any) => void;
  1372. confirm: (message: string, callback?: (state: boolean) => void, scope?: any) => void;
  1373. close: () => void;
  1374. }
  1375. interface ExecCommandEvent {
  1376. command: string;
  1377. ui: boolean;
  1378. value?: any;
  1379. }
  1380. interface BeforeGetContentEvent extends GetContentArgs {
  1381. selection?: boolean;
  1382. }
  1383. interface GetContentEvent extends BeforeGetContentEvent {
  1384. content: string;
  1385. }
  1386. interface BeforeSetContentEvent extends SetContentArgs {
  1387. content: string;
  1388. selection?: boolean;
  1389. }
  1390. interface SetContentEvent extends BeforeSetContentEvent {
  1391. content: string;
  1392. }
  1393. interface SaveContentEvent extends GetContentEvent {
  1394. save: boolean;
  1395. }
  1396. interface NewBlockEvent {
  1397. newBlock: Element;
  1398. }
  1399. interface NodeChangeEvent {
  1400. element: Element;
  1401. parents: Node[];
  1402. selectionChange?: boolean;
  1403. initial?: boolean;
  1404. }
  1405. interface FormatEvent {
  1406. format: string;
  1407. vars?: FormatVars;
  1408. node?: Node | RangeLikeObject | null;
  1409. }
  1410. interface ObjectResizeEvent {
  1411. target: HTMLElement;
  1412. width: number;
  1413. height: number;
  1414. origin: string;
  1415. }
  1416. interface ObjectSelectedEvent {
  1417. target: Node;
  1418. targetClone?: Node;
  1419. }
  1420. interface ScrollIntoViewEvent {
  1421. elm: HTMLElement;
  1422. alignToTop: boolean | undefined;
  1423. }
  1424. interface SetSelectionRangeEvent {
  1425. range: Range;
  1426. forward: boolean | undefined;
  1427. }
  1428. interface ShowCaretEvent {
  1429. target: Node;
  1430. direction: number;
  1431. before: boolean;
  1432. }
  1433. interface SwitchModeEvent {
  1434. mode: string;
  1435. }
  1436. interface ChangeEvent {
  1437. level: UndoLevel;
  1438. lastLevel: UndoLevel | undefined;
  1439. }
  1440. interface AddUndoEvent extends ChangeEvent {
  1441. originalEvent: Event | undefined;
  1442. }
  1443. interface UndoRedoEvent {
  1444. level: UndoLevel;
  1445. }
  1446. interface WindowEvent<T extends DialogData> {
  1447. dialog: InstanceApi<T>;
  1448. }
  1449. interface ProgressStateEvent {
  1450. state: boolean;
  1451. time?: number;
  1452. }
  1453. interface AfterProgressStateEvent {
  1454. state: boolean;
  1455. }
  1456. interface PlaceholderToggleEvent {
  1457. state: boolean;
  1458. }
  1459. interface LoadErrorEvent {
  1460. message: string;
  1461. }
  1462. interface PreProcessEvent extends ParserArgs {
  1463. node: Element;
  1464. }
  1465. interface PostProcessEvent extends ParserArgs {
  1466. content: string;
  1467. }
  1468. interface PastePlainTextToggleEvent {
  1469. state: boolean;
  1470. }
  1471. interface PastePreProcessEvent {
  1472. content: string;
  1473. readonly internal: boolean;
  1474. }
  1475. interface PastePostProcessEvent {
  1476. node: HTMLElement;
  1477. readonly internal: boolean;
  1478. }
  1479. interface NewTableRowEvent {
  1480. node: HTMLTableRowElement;
  1481. }
  1482. interface NewTableCellEvent {
  1483. node: HTMLTableCellElement;
  1484. }
  1485. interface TableEventData {
  1486. readonly structure: boolean;
  1487. readonly style: boolean;
  1488. }
  1489. interface TableModifiedEvent extends TableEventData {
  1490. readonly table: HTMLTableElement;
  1491. }
  1492. interface BeforeOpenNotificationEvent {
  1493. notification: NotificationSpec;
  1494. }
  1495. interface OpenNotificationEvent {
  1496. notification: NotificationApi;
  1497. }
  1498. interface EditorEventMap extends Omit<NativeEventMap, 'blur' | 'focus'> {
  1499. 'activate': {
  1500. relatedTarget: Editor | null;
  1501. };
  1502. 'deactivate': {
  1503. relatedTarget: Editor;
  1504. };
  1505. 'focus': {
  1506. blurredEditor: Editor | null;
  1507. };
  1508. 'blur': {
  1509. focusedEditor: Editor | null;
  1510. };
  1511. 'resize': UIEvent;
  1512. 'scroll': UIEvent;
  1513. 'detach': {};
  1514. 'remove': {};
  1515. 'init': {};
  1516. 'ScrollIntoView': ScrollIntoViewEvent;
  1517. 'AfterScrollIntoView': ScrollIntoViewEvent;
  1518. 'ObjectResized': ObjectResizeEvent;
  1519. 'ObjectResizeStart': ObjectResizeEvent;
  1520. 'SwitchMode': SwitchModeEvent;
  1521. 'ScrollWindow': Event;
  1522. 'ResizeWindow': UIEvent;
  1523. 'SkinLoaded': {};
  1524. 'SkinLoadError': LoadErrorEvent;
  1525. 'PluginLoadError': LoadErrorEvent;
  1526. 'ModelLoadError': LoadErrorEvent;
  1527. 'IconsLoadError': LoadErrorEvent;
  1528. 'ThemeLoadError': LoadErrorEvent;
  1529. 'LanguageLoadError': LoadErrorEvent;
  1530. 'BeforeExecCommand': ExecCommandEvent;
  1531. 'ExecCommand': ExecCommandEvent;
  1532. 'NodeChange': NodeChangeEvent;
  1533. 'FormatApply': FormatEvent;
  1534. 'FormatRemove': FormatEvent;
  1535. 'ShowCaret': ShowCaretEvent;
  1536. 'SelectionChange': {};
  1537. 'ObjectSelected': ObjectSelectedEvent;
  1538. 'BeforeObjectSelected': ObjectSelectedEvent;
  1539. 'GetSelectionRange': {
  1540. range: Range;
  1541. };
  1542. 'SetSelectionRange': SetSelectionRangeEvent;
  1543. 'AfterSetSelectionRange': SetSelectionRangeEvent;
  1544. 'BeforeGetContent': BeforeGetContentEvent;
  1545. 'GetContent': GetContentEvent;
  1546. 'BeforeSetContent': BeforeSetContentEvent;
  1547. 'SetContent': SetContentEvent;
  1548. 'SaveContent': SaveContentEvent;
  1549. 'RawSaveContent': SaveContentEvent;
  1550. 'LoadContent': {
  1551. load: boolean;
  1552. element: HTMLElement;
  1553. };
  1554. 'PreviewFormats': {};
  1555. 'AfterPreviewFormats': {};
  1556. 'ScriptsLoaded': {};
  1557. 'PreInit': {};
  1558. 'PostRender': {};
  1559. 'NewBlock': NewBlockEvent;
  1560. 'ClearUndos': {};
  1561. 'TypingUndo': {};
  1562. 'Redo': UndoRedoEvent;
  1563. 'Undo': UndoRedoEvent;
  1564. 'BeforeAddUndo': AddUndoEvent;
  1565. 'AddUndo': AddUndoEvent;
  1566. 'change': ChangeEvent;
  1567. 'CloseWindow': WindowEvent<any>;
  1568. 'OpenWindow': WindowEvent<any>;
  1569. 'ProgressState': ProgressStateEvent;
  1570. 'AfterProgressState': AfterProgressStateEvent;
  1571. 'PlaceholderToggle': PlaceholderToggleEvent;
  1572. 'tap': TouchEvent;
  1573. 'longpress': TouchEvent;
  1574. 'longpresscancel': {};
  1575. 'PreProcess': PreProcessEvent;
  1576. 'PostProcess': PostProcessEvent;
  1577. 'AutocompleterStart': AutocompleterEventArgs;
  1578. 'AutocompleterUpdate': AutocompleterEventArgs;
  1579. 'AutocompleterEnd': {};
  1580. 'PastePlainTextToggle': PastePlainTextToggleEvent;
  1581. 'PastePreProcess': PastePreProcessEvent;
  1582. 'PastePostProcess': PastePostProcessEvent;
  1583. 'TableModified': TableModifiedEvent;
  1584. 'NewRow': NewTableRowEvent;
  1585. 'NewCell': NewTableCellEvent;
  1586. 'SetAttrib': SetAttribEvent;
  1587. 'hide': {};
  1588. 'show': {};
  1589. 'dirty': {};
  1590. 'BeforeOpenNotification': BeforeOpenNotificationEvent;
  1591. 'OpenNotification': OpenNotificationEvent;
  1592. }
  1593. interface EditorManagerEventMap {
  1594. 'AddEditor': {
  1595. editor: Editor;
  1596. };
  1597. 'RemoveEditor': {
  1598. editor: Editor;
  1599. };
  1600. 'BeforeUnload': {
  1601. returnValue: any;
  1602. };
  1603. }
  1604. type EventTypes_d_ExecCommandEvent = ExecCommandEvent;
  1605. type EventTypes_d_BeforeGetContentEvent = BeforeGetContentEvent;
  1606. type EventTypes_d_GetContentEvent = GetContentEvent;
  1607. type EventTypes_d_BeforeSetContentEvent = BeforeSetContentEvent;
  1608. type EventTypes_d_SetContentEvent = SetContentEvent;
  1609. type EventTypes_d_SaveContentEvent = SaveContentEvent;
  1610. type EventTypes_d_NewBlockEvent = NewBlockEvent;
  1611. type EventTypes_d_NodeChangeEvent = NodeChangeEvent;
  1612. type EventTypes_d_FormatEvent = FormatEvent;
  1613. type EventTypes_d_ObjectResizeEvent = ObjectResizeEvent;
  1614. type EventTypes_d_ObjectSelectedEvent = ObjectSelectedEvent;
  1615. type EventTypes_d_ScrollIntoViewEvent = ScrollIntoViewEvent;
  1616. type EventTypes_d_SetSelectionRangeEvent = SetSelectionRangeEvent;
  1617. type EventTypes_d_ShowCaretEvent = ShowCaretEvent;
  1618. type EventTypes_d_SwitchModeEvent = SwitchModeEvent;
  1619. type EventTypes_d_ChangeEvent = ChangeEvent;
  1620. type EventTypes_d_AddUndoEvent = AddUndoEvent;
  1621. type EventTypes_d_UndoRedoEvent = UndoRedoEvent;
  1622. type EventTypes_d_WindowEvent<T extends DialogData> = WindowEvent<T>;
  1623. type EventTypes_d_ProgressStateEvent = ProgressStateEvent;
  1624. type EventTypes_d_AfterProgressStateEvent = AfterProgressStateEvent;
  1625. type EventTypes_d_PlaceholderToggleEvent = PlaceholderToggleEvent;
  1626. type EventTypes_d_LoadErrorEvent = LoadErrorEvent;
  1627. type EventTypes_d_PreProcessEvent = PreProcessEvent;
  1628. type EventTypes_d_PostProcessEvent = PostProcessEvent;
  1629. type EventTypes_d_PastePlainTextToggleEvent = PastePlainTextToggleEvent;
  1630. type EventTypes_d_PastePreProcessEvent = PastePreProcessEvent;
  1631. type EventTypes_d_PastePostProcessEvent = PastePostProcessEvent;
  1632. type EventTypes_d_NewTableRowEvent = NewTableRowEvent;
  1633. type EventTypes_d_NewTableCellEvent = NewTableCellEvent;
  1634. type EventTypes_d_TableEventData = TableEventData;
  1635. type EventTypes_d_TableModifiedEvent = TableModifiedEvent;
  1636. type EventTypes_d_BeforeOpenNotificationEvent = BeforeOpenNotificationEvent;
  1637. type EventTypes_d_OpenNotificationEvent = OpenNotificationEvent;
  1638. type EventTypes_d_EditorEventMap = EditorEventMap;
  1639. type EventTypes_d_EditorManagerEventMap = EditorManagerEventMap;
  1640. declare namespace EventTypes_d {
  1641. export { EventTypes_d_ExecCommandEvent as ExecCommandEvent, EventTypes_d_BeforeGetContentEvent as BeforeGetContentEvent, EventTypes_d_GetContentEvent as GetContentEvent, EventTypes_d_BeforeSetContentEvent as BeforeSetContentEvent, EventTypes_d_SetContentEvent as SetContentEvent, EventTypes_d_SaveContentEvent as SaveContentEvent, EventTypes_d_NewBlockEvent as NewBlockEvent, EventTypes_d_NodeChangeEvent as NodeChangeEvent, EventTypes_d_FormatEvent as FormatEvent, EventTypes_d_ObjectResizeEvent as ObjectResizeEvent, EventTypes_d_ObjectSelectedEvent as ObjectSelectedEvent, EventTypes_d_ScrollIntoViewEvent as ScrollIntoViewEvent, EventTypes_d_SetSelectionRangeEvent as SetSelectionRangeEvent, EventTypes_d_ShowCaretEvent as ShowCaretEvent, EventTypes_d_SwitchModeEvent as SwitchModeEvent, EventTypes_d_ChangeEvent as ChangeEvent, EventTypes_d_AddUndoEvent as AddUndoEvent, EventTypes_d_UndoRedoEvent as UndoRedoEvent, EventTypes_d_WindowEvent as WindowEvent, EventTypes_d_ProgressStateEvent as ProgressStateEvent, EventTypes_d_AfterProgressStateEvent as AfterProgressStateEvent, EventTypes_d_PlaceholderToggleEvent as PlaceholderToggleEvent, EventTypes_d_LoadErrorEvent as LoadErrorEvent, EventTypes_d_PreProcessEvent as PreProcessEvent, EventTypes_d_PostProcessEvent as PostProcessEvent, EventTypes_d_PastePlainTextToggleEvent as PastePlainTextToggleEvent, EventTypes_d_PastePreProcessEvent as PastePreProcessEvent, EventTypes_d_PastePostProcessEvent as PastePostProcessEvent, EventTypes_d_NewTableRowEvent as NewTableRowEvent, EventTypes_d_NewTableCellEvent as NewTableCellEvent, EventTypes_d_TableEventData as TableEventData, EventTypes_d_TableModifiedEvent as TableModifiedEvent, EventTypes_d_BeforeOpenNotificationEvent as BeforeOpenNotificationEvent, EventTypes_d_OpenNotificationEvent as OpenNotificationEvent, EventTypes_d_EditorEventMap as EditorEventMap, EventTypes_d_EditorManagerEventMap as EditorManagerEventMap, };
  1642. }
  1643. type Format_d_Formats = Formats;
  1644. type Format_d_Format = Format;
  1645. type Format_d_ApplyFormat = ApplyFormat;
  1646. type Format_d_BlockFormat = BlockFormat;
  1647. type Format_d_InlineFormat = InlineFormat;
  1648. type Format_d_SelectorFormat = SelectorFormat;
  1649. type Format_d_RemoveFormat = RemoveFormat;
  1650. type Format_d_RemoveBlockFormat = RemoveBlockFormat;
  1651. type Format_d_RemoveInlineFormat = RemoveInlineFormat;
  1652. type Format_d_RemoveSelectorFormat = RemoveSelectorFormat;
  1653. declare namespace Format_d {
  1654. export { Format_d_Formats as Formats, Format_d_Format as Format, Format_d_ApplyFormat as ApplyFormat, Format_d_BlockFormat as BlockFormat, Format_d_InlineFormat as InlineFormat, Format_d_SelectorFormat as SelectorFormat, Format_d_RemoveFormat as RemoveFormat, Format_d_RemoveBlockFormat as RemoveBlockFormat, Format_d_RemoveInlineFormat as RemoveInlineFormat, Format_d_RemoveSelectorFormat as RemoveSelectorFormat, };
  1655. }
  1656. declare type StyleFormat = BlockStyleFormat | InlineStyleFormat | SelectorStyleFormat;
  1657. declare type AllowedFormat = Separator | FormatReference | StyleFormat | NestedFormatting;
  1658. interface Separator {
  1659. title: string;
  1660. }
  1661. interface FormatReference {
  1662. title: string;
  1663. format: string;
  1664. icon?: string;
  1665. }
  1666. interface NestedFormatting {
  1667. title: string;
  1668. items: Array<FormatReference | StyleFormat>;
  1669. }
  1670. interface CommonStyleFormat {
  1671. name?: string;
  1672. title: string;
  1673. icon?: string;
  1674. }
  1675. interface BlockStyleFormat extends BlockFormat, CommonStyleFormat {
  1676. }
  1677. interface InlineStyleFormat extends InlineFormat, CommonStyleFormat {
  1678. }
  1679. interface SelectorStyleFormat extends SelectorFormat, CommonStyleFormat {
  1680. }
  1681. declare type EntityEncoding = 'named' | 'numeric' | 'raw' | 'named,numeric' | 'named+numeric' | 'numeric,named' | 'numeric+named';
  1682. interface ContentLanguage {
  1683. readonly title: string;
  1684. readonly code: string;
  1685. readonly customCode?: string;
  1686. }
  1687. declare type ThemeInitFunc = (editor: Editor, elm: HTMLElement) => {
  1688. editorContainer: HTMLElement;
  1689. iframeContainer: HTMLElement;
  1690. height?: number;
  1691. iframeHeight?: number;
  1692. api?: EditorUiApi;
  1693. };
  1694. declare type SetupCallback = (editor: Editor) => void;
  1695. declare type FilePickerCallback = (callback: (value: string, meta?: Record<string, any>) => void, value: string, meta: Record<string, any>) => void;
  1696. declare type FilePickerValidationStatus = 'valid' | 'unknown' | 'invalid' | 'none';
  1697. declare type FilePickerValidationCallback = (info: {
  1698. type: string;
  1699. url: string;
  1700. }, callback: (validation: {
  1701. status: FilePickerValidationStatus;
  1702. message: string;
  1703. }) => void) => void;
  1704. declare type PastePreProcessFn = (editor: Editor, args: PastePreProcessEvent) => void;
  1705. declare type PastePostProcessFn = (editor: Editor, args: PastePostProcessEvent) => void;
  1706. declare type URLConverter = (url: string, name: string, elm?: string | Element) => string;
  1707. declare type URLConverterCallback = (url: string, node: Node | string | undefined, on_save: boolean, name: string) => string;
  1708. interface ToolbarGroup {
  1709. name?: string;
  1710. items: string[];
  1711. }
  1712. declare type ToolbarMode = 'floating' | 'sliding' | 'scrolling' | 'wrap';
  1713. declare type ToolbarLocation = 'top' | 'bottom' | 'auto';
  1714. interface BaseEditorOptions {
  1715. a11y_advanced_options?: boolean;
  1716. add_form_submit_trigger?: boolean;
  1717. add_unload_trigger?: boolean;
  1718. allow_conditional_comments?: boolean;
  1719. allow_html_data_urls?: boolean;
  1720. allow_html_in_named_anchor?: boolean;
  1721. allow_script_urls?: boolean;
  1722. allow_svg_data_urls?: boolean;
  1723. allow_unsafe_link_target?: boolean;
  1724. anchor_bottom?: false | string;
  1725. anchor_top?: false | string;
  1726. auto_focus?: string | true;
  1727. automatic_uploads?: boolean;
  1728. base_url?: string;
  1729. block_formats?: string;
  1730. block_unsupported_drop?: boolean;
  1731. body_id?: string;
  1732. body_class?: string;
  1733. br_in_pre?: boolean;
  1734. br_newline_selector?: string;
  1735. browser_spellcheck?: boolean;
  1736. branding?: boolean;
  1737. cache_suffix?: string;
  1738. color_cols?: number;
  1739. color_cols_foreground?: number;
  1740. color_cols_background?: number;
  1741. color_map?: string[];
  1742. color_map_foreground?: string[];
  1743. color_map_background?: string[];
  1744. color_default_foreground?: string;
  1745. color_default_background?: string;
  1746. content_css?: boolean | string | string[];
  1747. content_css_cors?: boolean;
  1748. content_security_policy?: string;
  1749. content_style?: string;
  1750. content_langs?: ContentLanguage[];
  1751. contextmenu?: string | string[] | false;
  1752. contextmenu_never_use_native?: boolean;
  1753. convert_fonts_to_spans?: boolean;
  1754. convert_urls?: boolean;
  1755. custom_colors?: boolean;
  1756. custom_elements?: string;
  1757. custom_ui_selector?: string;
  1758. custom_undo_redo_levels?: number;
  1759. deprecation_warnings?: boolean;
  1760. directionality?: 'ltr' | 'rtl';
  1761. doctype?: string;
  1762. document_base_url?: string;
  1763. draggable_modal?: boolean;
  1764. editable_class?: string;
  1765. element_format?: 'xhtml' | 'html';
  1766. elementpath?: boolean;
  1767. encoding?: string;
  1768. end_container_on_empty_block?: boolean | string;
  1769. entities?: string;
  1770. entity_encoding?: EntityEncoding;
  1771. extended_valid_elements?: string;
  1772. event_root?: string;
  1773. file_picker_callback?: FilePickerCallback;
  1774. file_picker_types?: string;
  1775. file_picker_validator_handler?: FilePickerValidationCallback;
  1776. fix_list_elements?: boolean;
  1777. fixed_toolbar_container?: string;
  1778. fixed_toolbar_container_target?: HTMLElement;
  1779. font_css?: string | string[];
  1780. font_family_formats?: string;
  1781. font_size_classes?: string;
  1782. font_size_legacy_values?: string;
  1783. font_size_style_values?: string;
  1784. font_size_formats?: string;
  1785. forced_root_block?: string;
  1786. forced_root_block_attrs?: Record<string, string>;
  1787. formats?: Formats;
  1788. format_noneditable_selector?: string;
  1789. height?: number | string;
  1790. hidden_input?: boolean;
  1791. icons?: string;
  1792. icons_url?: string;
  1793. id?: string;
  1794. iframe_aria_text?: string;
  1795. iframe_attrs?: Record<string, string>;
  1796. images_file_types?: string;
  1797. images_replace_blob_uris?: boolean;
  1798. images_reuse_filename?: boolean;
  1799. images_upload_base_path?: string;
  1800. images_upload_credentials?: boolean;
  1801. images_upload_handler?: UploadHandler;
  1802. images_upload_url?: string;
  1803. indent?: boolean;
  1804. indent_after?: string;
  1805. indent_before?: string;
  1806. indent_use_margin?: boolean;
  1807. indentation?: string;
  1808. init_instance_callback?: SetupCallback;
  1809. inline?: boolean;
  1810. inline_boundaries?: boolean;
  1811. inline_boundaries_selector?: string;
  1812. inline_styles?: boolean;
  1813. invalid_elements?: string;
  1814. invalid_styles?: string | Record<string, string>;
  1815. keep_styles?: boolean;
  1816. language?: string;
  1817. language_load?: boolean;
  1818. language_url?: string;
  1819. line_height_formats?: string;
  1820. max_height?: number;
  1821. max_width?: number;
  1822. menu?: Record<string, {
  1823. title: string;
  1824. items: string;
  1825. }>;
  1826. menubar?: boolean | string;
  1827. min_height?: number;
  1828. min_width?: number;
  1829. model?: string;
  1830. model_url?: string;
  1831. newline_behavior?: 'block' | 'linebreak' | 'invert' | 'default';
  1832. no_newline_selector?: string;
  1833. noneditable_class?: string;
  1834. noneditable_regexp?: RegExp | RegExp[];
  1835. nowrap?: boolean;
  1836. object_resizing?: boolean | string;
  1837. paste_as_text?: boolean;
  1838. paste_block_drop?: boolean;
  1839. paste_data_images?: boolean;
  1840. paste_merge_formats?: boolean;
  1841. paste_postprocess?: PastePostProcessFn;
  1842. paste_preprocess?: PastePreProcessFn;
  1843. paste_remove_styles_if_webkit?: boolean;
  1844. paste_tab_spaces?: number;
  1845. paste_webkit_styles?: string;
  1846. placeholder?: string;
  1847. preserve_cdata?: boolean;
  1848. preview_styles?: false | string;
  1849. promotion?: boolean;
  1850. protect?: RegExp[];
  1851. readonly?: boolean;
  1852. referrer_policy?: ReferrerPolicy;
  1853. relative_urls?: boolean;
  1854. remove_script_host?: boolean;
  1855. remove_trailing_brs?: boolean;
  1856. removed_menuitems?: string;
  1857. resize?: boolean | 'both';
  1858. resize_img_proportional?: boolean;
  1859. root_name?: string;
  1860. schema?: SchemaType;
  1861. selector?: string;
  1862. setup?: SetupCallback;
  1863. sidebar_show?: string;
  1864. skin?: boolean | string;
  1865. skin_url?: string;
  1866. smart_paste?: boolean;
  1867. statusbar?: boolean;
  1868. style_formats?: AllowedFormat[];
  1869. style_formats_autohide?: boolean;
  1870. style_formats_merge?: boolean;
  1871. submit_patch?: boolean;
  1872. suffix?: string;
  1873. table_tab_navigation?: boolean;
  1874. target?: HTMLElement;
  1875. text_patterns?: RawPattern[] | false;
  1876. text_patterns_lookup?: RawDynamicPatternsLookup;
  1877. theme?: string | ThemeInitFunc | false;
  1878. theme_url?: string;
  1879. toolbar?: boolean | string | string[] | Array<ToolbarGroup>;
  1880. toolbar1?: string;
  1881. toolbar2?: string;
  1882. toolbar3?: string;
  1883. toolbar4?: string;
  1884. toolbar5?: string;
  1885. toolbar6?: string;
  1886. toolbar7?: string;
  1887. toolbar8?: string;
  1888. toolbar9?: string;
  1889. toolbar_groups?: Record<string, GroupToolbarButtonSpec>;
  1890. toolbar_location?: ToolbarLocation;
  1891. toolbar_mode?: ToolbarMode;
  1892. toolbar_sticky?: boolean;
  1893. toolbar_sticky_offset?: number;
  1894. typeahead_urls?: boolean;
  1895. url_converter?: URLConverter;
  1896. url_converter_scope?: any;
  1897. urlconverter_callback?: URLConverterCallback;
  1898. valid_children?: string;
  1899. valid_classes?: string | Record<string, string>;
  1900. valid_elements?: string;
  1901. valid_styles?: string | Record<string, string>;
  1902. verify_html?: boolean;
  1903. visual?: boolean;
  1904. visual_anchor_class?: string;
  1905. visual_table_class?: string;
  1906. width?: number | string;
  1907. disable_nodechange?: boolean;
  1908. forced_plugins?: string | string[];
  1909. plugin_base_urls?: Record<string, string>;
  1910. service_message?: string;
  1911. [key: string]: any;
  1912. }
  1913. interface RawEditorOptions extends BaseEditorOptions {
  1914. external_plugins?: Record<string, string>;
  1915. mobile?: RawEditorOptions;
  1916. plugins?: string | string[];
  1917. }
  1918. interface NormalizedEditorOptions extends BaseEditorOptions {
  1919. external_plugins: Record<string, string>;
  1920. forced_plugins: string[];
  1921. plugins: string[];
  1922. }
  1923. interface EditorOptions extends NormalizedEditorOptions {
  1924. a11y_advanced_options: boolean;
  1925. allow_unsafe_link_target: boolean;
  1926. anchor_bottom: string;
  1927. anchor_top: string;
  1928. automatic_uploads: boolean;
  1929. block_formats: string;
  1930. body_class: string;
  1931. body_id: string;
  1932. br_newline_selector: string;
  1933. color_map: string[];
  1934. color_cols: number;
  1935. color_cols_foreground: number;
  1936. color_cols_background: number;
  1937. color_default_background: string;
  1938. color_default_foreground: string;
  1939. content_css: string[];
  1940. contextmenu: string[];
  1941. custom_colors: boolean;
  1942. document_base_url: string;
  1943. draggable_modal: boolean;
  1944. editable_class: string;
  1945. font_css: string[];
  1946. font_family_formats: string;
  1947. font_size_classes: string;
  1948. font_size_formats: string;
  1949. font_size_legacy_values: string;
  1950. font_size_style_values: string;
  1951. forced_root_block: string;
  1952. forced_root_block_attrs: Record<string, string>;
  1953. format_noneditable_selector: string;
  1954. height: number | string;
  1955. iframe_attrs: Record<string, string>;
  1956. images_file_types: string;
  1957. images_upload_base_path: string;
  1958. images_upload_credentials: boolean;
  1959. images_upload_url: string;
  1960. indent_use_margin: boolean;
  1961. indentation: string;
  1962. inline: boolean;
  1963. inline_boundaries_selector: string;
  1964. language: string;
  1965. language_load: boolean;
  1966. language_url: string;
  1967. line_height_formats: string;
  1968. menu: Record<string, {
  1969. title: string;
  1970. items: string;
  1971. }>;
  1972. menubar: boolean | string;
  1973. model: string;
  1974. no_newline_selector: string;
  1975. noneditable_class: string;
  1976. noneditable_regexp: RegExp[];
  1977. object_resizing: string;
  1978. paste_as_text: boolean;
  1979. preview_styles: string;
  1980. promotion: boolean;
  1981. readonly: boolean;
  1982. removed_menuitems: string;
  1983. toolbar: boolean | string | string[] | Array<ToolbarGroup>;
  1984. toolbar_groups: Record<string, GroupToolbarButtonSpec>;
  1985. toolbar_location: ToolbarLocation;
  1986. toolbar_mode: ToolbarMode;
  1987. toolbar_persist: boolean;
  1988. toolbar_sticky: boolean;
  1989. toolbar_sticky_offset: number;
  1990. text_patterns: Pattern[];
  1991. text_patterns_lookup: DynamicPatternsLookup;
  1992. visual: boolean;
  1993. visual_anchor_class: string;
  1994. visual_table_class: string;
  1995. width: number | string;
  1996. }
  1997. declare type StyleMap = Record<string, string | number>;
  1998. interface StylesSettings {
  1999. allow_script_urls?: boolean;
  2000. allow_svg_data_urls?: boolean;
  2001. url_converter?: URLConverter;
  2002. url_converter_scope?: any;
  2003. }
  2004. interface Styles {
  2005. parse: (css: string | undefined) => Record<string, string>;
  2006. serialize: (styles: StyleMap, elementName?: string) => string;
  2007. }
  2008. declare type EventUtilsCallback<T> = (event: EventUtilsEvent<T>) => void | boolean;
  2009. declare type EventUtilsEvent<T> = NormalizedEvent<T> & {
  2010. metaKey: boolean;
  2011. };
  2012. interface Callback$1<T> {
  2013. func: EventUtilsCallback<T>;
  2014. scope: any;
  2015. }
  2016. interface CallbackList<T> extends Array<Callback$1<T>> {
  2017. fakeName: string | false;
  2018. capture: boolean;
  2019. nativeHandler: EventListener;
  2020. }
  2021. interface EventUtilsConstructor {
  2022. readonly prototype: EventUtils;
  2023. new (): EventUtils;
  2024. Event: EventUtils;
  2025. }
  2026. declare class EventUtils {
  2027. static Event: EventUtils;
  2028. domLoaded: boolean;
  2029. events: Record<number, Record<string, CallbackList<any>>>;
  2030. private readonly expando;
  2031. private hasFocusIn;
  2032. private count;
  2033. constructor();
  2034. bind<K extends keyof HTMLElementEventMap>(target: any, name: K, callback: EventUtilsCallback<HTMLElementEventMap[K]>, scope?: any): EventUtilsCallback<HTMLElementEventMap[K]>;
  2035. bind<T = any>(target: any, names: string, callback: EventUtilsCallback<T>, scope?: any): EventUtilsCallback<T>;
  2036. unbind<K extends keyof HTMLElementEventMap>(target: any, name: K, callback?: EventUtilsCallback<HTMLElementEventMap[K]>): this;
  2037. unbind<T = any>(target: any, names: string, callback?: EventUtilsCallback<T>): this;
  2038. unbind(target: any): this;
  2039. fire(target: any, name: string, args?: {}): this;
  2040. dispatch(target: any, name: string, args?: {}): this;
  2041. clean(target: any): this;
  2042. destroy(): void;
  2043. cancel<T>(e: EventUtilsEvent<T>): boolean;
  2044. private executeHandlers;
  2045. }
  2046. interface SetAttribEvent {
  2047. attrElm: HTMLElement;
  2048. attrName: string;
  2049. attrValue: string | boolean | number | null;
  2050. }
  2051. interface DOMUtilsSettings {
  2052. schema: Schema;
  2053. url_converter: URLConverter;
  2054. url_converter_scope: any;
  2055. ownEvents: boolean;
  2056. keep_values: boolean;
  2057. update_styles: boolean;
  2058. root_element: HTMLElement | null;
  2059. collect: boolean;
  2060. onSetAttrib: (event: SetAttribEvent) => void;
  2061. contentCssCors: boolean;
  2062. referrerPolicy: ReferrerPolicy;
  2063. }
  2064. declare type Target = Node | Window;
  2065. declare type RunArguments<T extends Node = Node> = string | T | Array<string | T> | null;
  2066. declare type BoundEvent = [
  2067. Target,
  2068. string,
  2069. EventUtilsCallback<any>,
  2070. any
  2071. ];
  2072. declare type Callback<K extends string> = EventUtilsCallback<MappedEvent<HTMLElementEventMap, K>>;
  2073. declare type RunResult<T, R> = T extends Array<any> ? R[] : false | R;
  2074. interface DOMUtils {
  2075. doc: Document;
  2076. settings: Partial<DOMUtilsSettings>;
  2077. win: Window;
  2078. files: Record<string, boolean>;
  2079. stdMode: boolean;
  2080. boxModel: boolean;
  2081. styleSheetLoader: StyleSheetLoader;
  2082. boundEvents: BoundEvent[];
  2083. styles: Styles;
  2084. schema: Schema;
  2085. events: EventUtils;
  2086. root: Node | null;
  2087. isBlock: {
  2088. (node: Node | null): node is HTMLElement;
  2089. (node: string): boolean;
  2090. };
  2091. clone: (node: Node, deep: boolean) => Node;
  2092. getRoot: () => HTMLElement;
  2093. getViewPort: (argWin?: Window) => GeomRect;
  2094. getRect: (elm: string | HTMLElement) => GeomRect;
  2095. getSize: (elm: string | HTMLElement) => {
  2096. w: number;
  2097. h: number;
  2098. };
  2099. getParent: {
  2100. <K extends keyof HTMLElementTagNameMap>(node: string | Node | null, selector: K, root?: Node): HTMLElementTagNameMap[K] | null;
  2101. <T extends Element>(node: string | Node | null, selector: string | ((node: Node) => node is T), root?: Node): T | null;
  2102. (node: string | Node | null, selector?: string | ((node: Node) => boolean | void), root?: Node): Node | null;
  2103. };
  2104. getParents: {
  2105. <K extends keyof HTMLElementTagNameMap>(elm: string | HTMLElementTagNameMap[K] | null, selector: K, root?: Node, collect?: boolean): Array<HTMLElementTagNameMap[K]>;
  2106. <T extends Element>(node: string | Node | null, selector: string | ((node: Node) => node is T), root?: Node, collect?: boolean): T[];
  2107. (elm: string | Node | null, selector?: string | ((node: Node) => boolean | void), root?: Node, collect?: boolean): Node[];
  2108. };
  2109. get: {
  2110. <T extends Node>(elm: T): T;
  2111. (elm: string): HTMLElement | null;
  2112. };
  2113. getNext: (node: Node | null, selector: string | ((node: Node) => boolean)) => Node | null;
  2114. getPrev: (node: Node | null, selector: string | ((node: Node) => boolean)) => Node | null;
  2115. select: {
  2116. <K extends keyof HTMLElementTagNameMap>(selector: K, scope?: string | Node): Array<HTMLElementTagNameMap[K]>;
  2117. <T extends HTMLElement = HTMLElement>(selector: string, scope?: string | Node): T[];
  2118. };
  2119. is: {
  2120. <T extends Element>(elm: Node | Node[] | null, selector: string): elm is T;
  2121. (elm: Node | Node[] | null, selector: string): boolean;
  2122. };
  2123. add: (parentElm: RunArguments, name: string | Element, attrs?: Record<string, string | boolean | number | null>, html?: string | Node | null, create?: boolean) => HTMLElement;
  2124. create: {
  2125. <K extends keyof HTMLElementTagNameMap>(name: K, attrs?: Record<string, string | boolean | number | null>, html?: string | Node | null): HTMLElementTagNameMap[K];
  2126. (name: string, attrs?: Record<string, string | boolean | number | null>, html?: string | Node | null): HTMLElement;
  2127. };
  2128. createHTML: (name: string, attrs?: Record<string, string | null>, html?: string) => string;
  2129. createFragment: (html?: string) => DocumentFragment;
  2130. remove: {
  2131. <T extends Node>(node: T | T[], keepChildren?: boolean): typeof node extends Array<any> ? T[] : T;
  2132. <T extends Node>(node: string, keepChildren?: boolean): T | false;
  2133. };
  2134. getStyle: {
  2135. (elm: Element, name: string, computed: true): string;
  2136. (elm: string | Element | null, name: string, computed?: boolean): string | undefined;
  2137. };
  2138. setStyle: (elm: string | Element | Element[], name: string, value: string | number | null) => void;
  2139. setStyles: (elm: string | Element | Element[], stylesArg: StyleMap) => void;
  2140. removeAllAttribs: (e: RunArguments<Element>) => void;
  2141. setAttrib: (elm: RunArguments<Element>, name: string, value: string | boolean | number | null) => void;
  2142. setAttribs: (elm: RunArguments<Element>, attrs: Record<string, string | boolean | number | null>) => void;
  2143. getAttrib: (elm: string | Element | null, name: string, defaultVal?: string) => string;
  2144. getAttribs: (elm: string | Element) => NamedNodeMap | Attr[];
  2145. getPos: (elm: string | Element, rootElm?: Node) => {
  2146. x: number;
  2147. y: number;
  2148. };
  2149. parseStyle: (cssText: string) => Record<string, string>;
  2150. serializeStyle: (stylesArg: StyleMap, name?: string) => string;
  2151. addStyle: (cssText: string) => void;
  2152. loadCSS: (url: string) => void;
  2153. hasClass: (elm: string | Element, cls: string) => boolean;
  2154. addClass: (elm: RunArguments<Element>, cls: string) => void;
  2155. removeClass: (elm: RunArguments<Element>, cls: string) => void;
  2156. toggleClass: (elm: RunArguments<Element>, cls: string, state?: boolean) => void;
  2157. show: (elm: string | Node | Node[]) => void;
  2158. hide: (elm: string | Node | Node[]) => void;
  2159. isHidden: (elm: string | Node) => boolean;
  2160. uniqueId: (prefix?: string) => string;
  2161. setHTML: (elm: RunArguments<Element>, html: string) => void;
  2162. getOuterHTML: (elm: string | Node) => string;
  2163. setOuterHTML: (elm: string | Node | Node[], html: string) => void;
  2164. decode: (text: string) => string;
  2165. encode: (text: string) => string;
  2166. insertAfter: {
  2167. <T extends Node>(node: T | T[], reference: string | Node): T;
  2168. <T extends Node>(node: RunArguments<T>, reference: string | Node): RunResult<typeof node, T>;
  2169. };
  2170. replace: {
  2171. <T extends Node>(newElm: Node, oldElm: T | T[], keepChildren?: boolean): T;
  2172. <T extends Node>(newElm: Node, oldElm: RunArguments<T>, keepChildren?: boolean): false | T;
  2173. };
  2174. rename: {
  2175. <K extends keyof HTMLElementTagNameMap>(elm: Element, name: K): HTMLElementTagNameMap[K];
  2176. (elm: Element, name: string): Element;
  2177. };
  2178. findCommonAncestor: (a: Node, b: Node) => Node | null;
  2179. run<R, T extends Node>(this: DOMUtils, elm: T | T[], func: (node: T) => R, scope?: any): typeof elm extends Array<any> ? R[] : R;
  2180. run<R, T extends Node>(this: DOMUtils, elm: RunArguments<T>, func: (node: T) => R, scope?: any): RunResult<typeof elm, R>;
  2181. isEmpty: (node: Node, elements?: Record<string, any>) => boolean;
  2182. createRng: () => Range;
  2183. nodeIndex: (node: Node, normalized?: boolean) => number;
  2184. split: {
  2185. <T extends Node>(parentElm: Node, splitElm: Node, replacementElm: T): T | undefined;
  2186. <T extends Node>(parentElm: Node, splitElm: T): T | undefined;
  2187. };
  2188. bind: {
  2189. <K extends string>(target: Target, name: K, func: Callback<K>, scope?: any): Callback<K>;
  2190. <K extends string>(target: Target[], name: K, func: Callback<K>, scope?: any): Callback<K>[];
  2191. };
  2192. unbind: {
  2193. <K extends string>(target: Target, name?: K, func?: EventUtilsCallback<MappedEvent<HTMLElementEventMap, K>>): EventUtils;
  2194. <K extends string>(target: Target[], name?: K, func?: EventUtilsCallback<MappedEvent<HTMLElementEventMap, K>>): EventUtils[];
  2195. };
  2196. fire: (target: Node | Window, name: string, evt?: {}) => EventUtils;
  2197. dispatch: (target: Node | Window, name: string, evt?: {}) => EventUtils;
  2198. getContentEditable: (node: Node) => string | null;
  2199. getContentEditableParent: (node: Node) => string | null;
  2200. destroy: () => void;
  2201. isChildOf: (node: Node, parent: Node) => boolean;
  2202. dumpRng: (r: Range) => string;
  2203. }
  2204. interface ClientRect {
  2205. left: number;
  2206. top: number;
  2207. bottom: number;
  2208. right: number;
  2209. width: number;
  2210. height: number;
  2211. }
  2212. interface BookmarkManager {
  2213. getBookmark: (type?: number, normalized?: boolean) => Bookmark;
  2214. moveToBookmark: (bookmark: Bookmark) => void;
  2215. }
  2216. interface ControlSelection {
  2217. isResizable: (elm: Element) => boolean;
  2218. showResizeRect: (elm: HTMLElement) => void;
  2219. hideResizeRect: () => void;
  2220. updateResizeRect: (evt: EditorEvent<any>) => void;
  2221. destroy: () => void;
  2222. }
  2223. interface WriterSettings {
  2224. element_format?: 'xhtml' | 'html';
  2225. entities?: string;
  2226. entity_encoding?: EntityEncoding;
  2227. indent?: boolean;
  2228. indent_after?: string;
  2229. indent_before?: string;
  2230. }
  2231. declare type Attributes = Array<{
  2232. name: string;
  2233. value: string;
  2234. }>;
  2235. interface Writer {
  2236. cdata: (text: string) => void;
  2237. comment: (text: string) => void;
  2238. doctype: (text: string) => void;
  2239. end: (name: string) => void;
  2240. getContent: () => string;
  2241. pi: (name: string, text?: string) => void;
  2242. reset: () => void;
  2243. start: (name: string, attrs?: Attributes | null, empty?: boolean) => void;
  2244. text: (text: string, raw?: boolean) => void;
  2245. }
  2246. interface HtmlSerializerSettings extends WriterSettings {
  2247. inner?: boolean;
  2248. validate?: boolean;
  2249. }
  2250. interface HtmlSerializer {
  2251. serialize: (node: AstNode) => string;
  2252. }
  2253. interface DomSerializerSettings extends DomParserSettings, WriterSettings, SchemaSettings, HtmlSerializerSettings {
  2254. url_converter?: URLConverter;
  2255. url_converter_scope?: {};
  2256. }
  2257. interface DomSerializerImpl {
  2258. schema: Schema;
  2259. addNodeFilter: (name: string, callback: ParserFilterCallback) => void;
  2260. addAttributeFilter: (name: string, callback: ParserFilterCallback) => void;
  2261. getNodeFilters: () => ParserFilter[];
  2262. getAttributeFilters: () => ParserFilter[];
  2263. removeNodeFilter: (name: string, callback?: ParserFilterCallback) => void;
  2264. removeAttributeFilter: (name: string, callback?: ParserFilterCallback) => void;
  2265. serialize: {
  2266. (node: Element, parserArgs: {
  2267. format: 'tree';
  2268. } & ParserArgs): AstNode;
  2269. (node: Element, parserArgs?: ParserArgs): string;
  2270. };
  2271. addRules: (rules: string) => void;
  2272. setRules: (rules: string) => void;
  2273. addTempAttr: (name: string) => void;
  2274. getTempAttrs: () => string[];
  2275. }
  2276. interface DomSerializer extends DomSerializerImpl {
  2277. }
  2278. interface EditorSelection {
  2279. bookmarkManager: BookmarkManager;
  2280. controlSelection: ControlSelection;
  2281. dom: DOMUtils;
  2282. win: Window;
  2283. serializer: DomSerializer;
  2284. editor: Editor;
  2285. collapse: (toStart?: boolean) => void;
  2286. setCursorLocation: {
  2287. (node: Node, offset: number): void;
  2288. (): void;
  2289. };
  2290. getContent: {
  2291. (args: {
  2292. format: 'tree';
  2293. } & Partial<GetSelectionContentArgs>): AstNode;
  2294. (args?: Partial<GetSelectionContentArgs>): string;
  2295. };
  2296. setContent: (content: string, args?: Partial<SetSelectionContentArgs>) => void;
  2297. getBookmark: (type?: number, normalized?: boolean) => Bookmark;
  2298. moveToBookmark: (bookmark: Bookmark) => void;
  2299. select: (node: Node, content?: boolean) => Node;
  2300. isCollapsed: () => boolean;
  2301. isForward: () => boolean;
  2302. setNode: (elm: Element) => Element;
  2303. getNode: () => HTMLElement;
  2304. getSel: () => Selection | null;
  2305. setRng: (rng: Range, forward?: boolean) => void;
  2306. getRng: () => Range;
  2307. getStart: (real?: boolean) => Element;
  2308. getEnd: (real?: boolean) => Element;
  2309. getSelectedBlocks: (startElm?: Element, endElm?: Element) => Element[];
  2310. normalize: () => Range;
  2311. selectorChanged: (selector: string, callback: (active: boolean, args: {
  2312. node: Node;
  2313. selector: String;
  2314. parents: Node[];
  2315. }) => void) => EditorSelection;
  2316. selectorChangedWithUnbind: (selector: string, callback: (active: boolean, args: {
  2317. node: Node;
  2318. selector: String;
  2319. parents: Node[];
  2320. }) => void) => {
  2321. unbind: () => void;
  2322. };
  2323. getScrollContainer: () => HTMLElement | undefined;
  2324. scrollIntoView: (elm?: HTMLElement, alignToTop?: boolean) => void;
  2325. placeCaretAt: (clientX: number, clientY: number) => void;
  2326. getBoundingClientRect: () => ClientRect | DOMRect;
  2327. destroy: () => void;
  2328. expand: (options?: {
  2329. type: 'word';
  2330. }) => void;
  2331. }
  2332. declare type EditorCommandCallback<S> = (this: S, ui: boolean, value: any) => void;
  2333. declare type EditorCommandsCallback = (command: string, ui: boolean, value?: any) => void;
  2334. interface Commands {
  2335. state: Record<string, (command: string) => boolean>;
  2336. exec: Record<string, EditorCommandsCallback>;
  2337. value: Record<string, (command: string) => string>;
  2338. }
  2339. interface ExecCommandArgs {
  2340. skip_focus?: boolean;
  2341. }
  2342. interface EditorCommandsConstructor {
  2343. readonly prototype: EditorCommands;
  2344. new (editor: Editor): EditorCommands;
  2345. }
  2346. declare class EditorCommands {
  2347. private readonly editor;
  2348. private commands;
  2349. constructor(editor: Editor);
  2350. execCommand(command: string, ui?: boolean, value?: any, args?: ExecCommandArgs): boolean;
  2351. queryCommandState(command: string): boolean;
  2352. queryCommandValue(command: string): string;
  2353. addCommands<K extends keyof Commands>(commandList: Commands[K], type: K): void;
  2354. addCommands(commandList: Record<string, EditorCommandsCallback>): void;
  2355. addCommand<S>(command: string, callback: EditorCommandCallback<S>, scope: S): void;
  2356. addCommand(command: string, callback: EditorCommandCallback<Editor>): void;
  2357. queryCommandSupported(command: string): boolean;
  2358. addQueryStateHandler<S>(command: string, callback: (this: S) => boolean, scope: S): void;
  2359. addQueryStateHandler(command: string, callback: (this: Editor) => boolean): void;
  2360. addQueryValueHandler<S>(command: string, callback: (this: S) => string, scope: S): void;
  2361. addQueryValueHandler(command: string, callback: (this: Editor) => string): void;
  2362. }
  2363. interface RawString {
  2364. raw: string;
  2365. }
  2366. declare type Primitive = string | number | boolean | Record<string | number, any> | Function;
  2367. declare type TokenisedString = [
  2368. string,
  2369. ...Primitive[]
  2370. ];
  2371. declare type Untranslated = Primitive | TokenisedString | RawString | null | undefined;
  2372. declare type TranslatedString = string;
  2373. interface I18n {
  2374. getData: () => Record<string, Record<string, string>>;
  2375. setCode: (newCode: string) => void;
  2376. getCode: () => string;
  2377. add: (code: string, items: Record<string, string>) => void;
  2378. translate: (text: Untranslated) => TranslatedString;
  2379. isRtl: () => boolean;
  2380. hasCode: (code: string) => boolean;
  2381. }
  2382. interface Observable<T extends {}> {
  2383. fire<K extends string, U extends MappedEvent<T, K>>(name: K, args?: U, bubble?: boolean): EditorEvent<U>;
  2384. dispatch<K extends string, U extends MappedEvent<T, K>>(name: K, args?: U, bubble?: boolean): EditorEvent<U>;
  2385. on<K extends string>(name: K, callback: (event: EditorEvent<MappedEvent<T, K>>) => void, prepend?: boolean): EventDispatcher<T>;
  2386. off<K extends string>(name?: K, callback?: (event: EditorEvent<MappedEvent<T, K>>) => void): EventDispatcher<T>;
  2387. once<K extends string>(name: K, callback: (event: EditorEvent<MappedEvent<T, K>>) => void): EventDispatcher<T>;
  2388. hasEventListeners(name: string): boolean;
  2389. }
  2390. interface URISettings {
  2391. base_uri?: URI;
  2392. }
  2393. interface URIConstructor {
  2394. readonly prototype: URI;
  2395. new (url: string, settings?: URISettings): URI;
  2396. getDocumentBaseUrl: (loc: {
  2397. protocol: string;
  2398. host?: string;
  2399. href?: string;
  2400. pathname?: string;
  2401. }) => string;
  2402. parseDataUri: (uri: string) => {
  2403. type: string;
  2404. data: string;
  2405. };
  2406. }
  2407. interface SafeUriOptions {
  2408. readonly allow_html_data_urls?: boolean;
  2409. readonly allow_script_urls?: boolean;
  2410. readonly allow_svg_data_urls?: boolean;
  2411. }
  2412. declare class URI {
  2413. static parseDataUri(uri: string): {
  2414. type: string | undefined;
  2415. data: string;
  2416. };
  2417. static isDomSafe(uri: string, context?: string, options?: SafeUriOptions): boolean;
  2418. static getDocumentBaseUrl(loc: {
  2419. protocol: string;
  2420. host?: string;
  2421. href?: string;
  2422. pathname?: string;
  2423. }): string;
  2424. source: string;
  2425. protocol: string | undefined;
  2426. authority: string | undefined;
  2427. userInfo: string | undefined;
  2428. user: string | undefined;
  2429. password: string | undefined;
  2430. host: string | undefined;
  2431. port: string | undefined;
  2432. relative: string | undefined;
  2433. path: string;
  2434. directory: string;
  2435. file: string | undefined;
  2436. query: string | undefined;
  2437. anchor: string | undefined;
  2438. settings: URISettings;
  2439. constructor(url: string, settings?: URISettings);
  2440. setPath(path: string): void;
  2441. toRelative(uri: string): string;
  2442. toAbsolute(uri: string, noHost?: boolean): string;
  2443. isSameOrigin(uri: URI): boolean;
  2444. toRelPath(base: string, path: string): string;
  2445. toAbsPath(base: string, path: string): string;
  2446. getURI(noProtoHost?: boolean): string;
  2447. }
  2448. interface EditorManager extends Observable<EditorManagerEventMap> {
  2449. defaultOptions: RawEditorOptions;
  2450. majorVersion: string;
  2451. minorVersion: string;
  2452. releaseDate: string;
  2453. activeEditor: Editor | null;
  2454. focusedEditor: Editor | null;
  2455. baseURI: URI;
  2456. baseURL: string;
  2457. documentBaseURL: string;
  2458. i18n: I18n;
  2459. suffix: string;
  2460. add(this: EditorManager, editor: Editor): Editor;
  2461. addI18n: (code: string, item: Record<string, string>) => void;
  2462. createEditor(this: EditorManager, id: string, options: RawEditorOptions): Editor;
  2463. execCommand(this: EditorManager, cmd: string, ui: boolean, value: any): boolean;
  2464. get(this: EditorManager): Editor[];
  2465. get(this: EditorManager, id: number | string): Editor | null;
  2466. init(this: EditorManager, options: RawEditorOptions): Promise<Editor[]>;
  2467. overrideDefaults(this: EditorManager, defaultOptions: Partial<RawEditorOptions>): void;
  2468. remove(this: EditorManager): void;
  2469. remove(this: EditorManager, selector: string): void;
  2470. remove(this: EditorManager, editor: Editor): Editor | null;
  2471. setActive(this: EditorManager, editor: Editor): void;
  2472. setup(this: EditorManager): void;
  2473. translate: (text: Untranslated) => TranslatedString;
  2474. triggerSave: () => void;
  2475. _setBaseUrl(this: EditorManager, baseUrl: string): void;
  2476. }
  2477. interface EditorObservable extends Observable<EditorEventMap> {
  2478. bindPendingEventDelegates(this: Editor): void;
  2479. toggleNativeEvent(this: Editor, name: string, state: boolean): void;
  2480. unbindAllNativeEvents(this: Editor): void;
  2481. }
  2482. interface ProcessorSuccess<T> {
  2483. valid: true;
  2484. value: T;
  2485. }
  2486. interface ProcessorError {
  2487. valid: false;
  2488. message: string;
  2489. }
  2490. declare type SimpleProcessor = (value: unknown) => boolean;
  2491. declare type Processor<T> = (value: unknown) => ProcessorSuccess<T> | ProcessorError;
  2492. interface BuiltInOptionTypeMap {
  2493. 'string': string;
  2494. 'number': number;
  2495. 'boolean': boolean;
  2496. 'array': any[];
  2497. 'function': Function;
  2498. 'object': any;
  2499. 'string[]': string[];
  2500. 'object[]': any[];
  2501. 'regexp': RegExp;
  2502. }
  2503. declare type BuiltInOptionType = keyof BuiltInOptionTypeMap;
  2504. interface BaseOptionSpec {
  2505. immutable?: boolean;
  2506. deprecated?: boolean;
  2507. docsUrl?: string;
  2508. }
  2509. interface BuiltInOptionSpec<K extends BuiltInOptionType> extends BaseOptionSpec {
  2510. processor: K;
  2511. default?: BuiltInOptionTypeMap[K];
  2512. }
  2513. interface SimpleOptionSpec<T> extends BaseOptionSpec {
  2514. processor: SimpleProcessor;
  2515. default?: T;
  2516. }
  2517. interface OptionSpec<T, U> extends BaseOptionSpec {
  2518. processor: Processor<U>;
  2519. default?: T;
  2520. }
  2521. interface Options {
  2522. register: {
  2523. <K extends BuiltInOptionType>(name: string, spec: BuiltInOptionSpec<K>): void;
  2524. <K extends keyof NormalizedEditorOptions>(name: K, spec: OptionSpec<NormalizedEditorOptions[K], EditorOptions[K]> | SimpleOptionSpec<NormalizedEditorOptions[K]>): void;
  2525. <T, U>(name: string, spec: OptionSpec<T, U>): void;
  2526. <T>(name: string, spec: SimpleOptionSpec<T>): void;
  2527. };
  2528. isRegistered: (name: string) => boolean;
  2529. get: {
  2530. <K extends keyof EditorOptions>(name: K): EditorOptions[K];
  2531. <T>(name: string): T | undefined;
  2532. };
  2533. set: <K extends string, T>(name: K, value: K extends keyof NormalizedEditorOptions ? NormalizedEditorOptions[K] : T) => boolean;
  2534. unset: (name: string) => boolean;
  2535. isSet: (name: string) => boolean;
  2536. }
  2537. interface UploadResult$1 {
  2538. element: HTMLImageElement;
  2539. status: boolean;
  2540. blobInfo: BlobInfo;
  2541. uploadUri: string;
  2542. removed: boolean;
  2543. }
  2544. interface EditorUpload {
  2545. blobCache: BlobCache;
  2546. addFilter: (filter: (img: HTMLImageElement) => boolean) => void;
  2547. uploadImages: () => Promise<UploadResult$1[]>;
  2548. uploadImagesAuto: () => Promise<UploadResult$1[]>;
  2549. scanForImages: () => Promise<BlobInfoImagePair[]>;
  2550. destroy: () => void;
  2551. }
  2552. declare type FormatChangeCallback = (state: boolean, data: {
  2553. node: Node;
  2554. format: string;
  2555. parents: Element[];
  2556. }) => void;
  2557. interface FormatRegistry {
  2558. get: {
  2559. (name: string): Format[] | undefined;
  2560. (): Record<string, Format[]>;
  2561. };
  2562. has: (name: string) => boolean;
  2563. register: (name: string | Formats, format?: Format[] | Format) => void;
  2564. unregister: (name: string) => Formats;
  2565. }
  2566. interface Formatter extends FormatRegistry {
  2567. apply: (name: string, vars?: FormatVars, node?: Node | RangeLikeObject | null) => void;
  2568. remove: (name: string, vars?: FormatVars, node?: Node | Range, similar?: boolean) => void;
  2569. toggle: (name: string, vars?: FormatVars, node?: Node) => void;
  2570. match: (name: string, vars?: FormatVars, node?: Node, similar?: boolean) => boolean;
  2571. closest: (names: string[]) => string | null;
  2572. matchAll: (names: string[], vars?: FormatVars) => string[];
  2573. matchNode: (node: Node | null, name: string, vars?: FormatVars, similar?: boolean) => Format | undefined;
  2574. canApply: (name: string) => boolean;
  2575. formatChanged: (names: string, callback: FormatChangeCallback, similar?: boolean, vars?: FormatVars) => {
  2576. unbind: () => void;
  2577. };
  2578. getCssText: (format: string | ApplyFormat) => string;
  2579. }
  2580. interface EditorMode {
  2581. isReadOnly: () => boolean;
  2582. set: (mode: string) => void;
  2583. get: () => string;
  2584. register: (mode: string, api: EditorModeApi) => void;
  2585. }
  2586. interface EditorModeApi {
  2587. activate: () => void;
  2588. deactivate: () => void;
  2589. editorReadOnly: boolean;
  2590. }
  2591. interface Model {
  2592. readonly table: {
  2593. readonly getSelectedCells: () => HTMLTableCellElement[];
  2594. readonly clearSelectedCells: (container: Node) => void;
  2595. };
  2596. }
  2597. declare type ModelManager = AddOnManager<Model>;
  2598. interface Plugin {
  2599. getMetadata?: () => {
  2600. name: string;
  2601. url: string;
  2602. };
  2603. init?: (editor: Editor, url: string) => void;
  2604. [key: string]: any;
  2605. }
  2606. declare type PluginManager = AddOnManager<void | Plugin>;
  2607. interface ShortcutsConstructor {
  2608. readonly prototype: Shortcuts;
  2609. new (editor: Editor): Shortcuts;
  2610. }
  2611. declare type CommandFunc = string | [
  2612. string,
  2613. boolean,
  2614. any
  2615. ] | (() => void);
  2616. declare class Shortcuts {
  2617. private readonly editor;
  2618. private readonly shortcuts;
  2619. private pendingPatterns;
  2620. constructor(editor: Editor);
  2621. add(pattern: string, desc: string | null, cmdFunc: CommandFunc, scope?: any): boolean;
  2622. remove(pattern: string): boolean;
  2623. private normalizeCommandFunc;
  2624. private createShortcut;
  2625. private hasModifier;
  2626. private isFunctionKey;
  2627. private matchShortcut;
  2628. private executeShortcutAction;
  2629. }
  2630. interface RenderResult {
  2631. iframeContainer?: HTMLElement;
  2632. editorContainer: HTMLElement;
  2633. api?: Partial<EditorUiApi>;
  2634. }
  2635. interface Theme {
  2636. ui?: any;
  2637. inline?: any;
  2638. execCommand?: (command: string, ui?: boolean, value?: any) => boolean;
  2639. destroy?: () => void;
  2640. init?: (editor: Editor, url: string) => void;
  2641. renderUI?: () => RenderResult;
  2642. getNotificationManagerImpl?: () => NotificationManagerImpl;
  2643. getWindowManagerImpl?: () => WindowManagerImpl;
  2644. }
  2645. declare type ThemeManager = AddOnManager<void | Theme>;
  2646. interface EditorConstructor {
  2647. readonly prototype: Editor;
  2648. new (id: string, options: RawEditorOptions, editorManager: EditorManager): Editor;
  2649. }
  2650. declare class Editor implements EditorObservable {
  2651. documentBaseUrl: string;
  2652. baseUri: URI;
  2653. id: string;
  2654. plugins: Record<string, Plugin>;
  2655. documentBaseURI: URI;
  2656. baseURI: URI;
  2657. contentCSS: string[];
  2658. contentStyles: string[];
  2659. ui: EditorUi;
  2660. mode: EditorMode;
  2661. options: Options;
  2662. shortcuts: Shortcuts;
  2663. loadedCSS: Record<string, any>;
  2664. editorCommands: EditorCommands;
  2665. suffix: string;
  2666. editorManager: EditorManager;
  2667. hidden: boolean;
  2668. inline: boolean;
  2669. hasVisual: boolean;
  2670. isNotDirty: boolean;
  2671. annotator: Annotator;
  2672. bodyElement: HTMLElement | undefined;
  2673. bookmark: any;
  2674. composing: boolean;
  2675. container: HTMLElement;
  2676. contentAreaContainer: HTMLElement;
  2677. contentDocument: Document;
  2678. contentWindow: Window;
  2679. delegates: Record<string, EventUtilsCallback<any>> | undefined;
  2680. destroyed: boolean;
  2681. dom: DOMUtils;
  2682. editorContainer: HTMLElement;
  2683. editorUpload: EditorUpload;
  2684. eventRoot: Element | undefined;
  2685. formatter: Formatter;
  2686. formElement: HTMLElement | undefined;
  2687. formEventDelegate: ((e: Event) => void) | undefined;
  2688. hasHiddenInput: boolean;
  2689. iframeElement: HTMLIFrameElement | null;
  2690. iframeHTML: string | undefined;
  2691. initialized: boolean;
  2692. notificationManager: NotificationManager;
  2693. orgDisplay: string;
  2694. orgVisibility: string | undefined;
  2695. parser: DomParser;
  2696. quirks: Quirks;
  2697. readonly: boolean;
  2698. removed: boolean;
  2699. schema: Schema;
  2700. selection: EditorSelection;
  2701. serializer: DomSerializer;
  2702. startContent: string;
  2703. targetElm: HTMLElement;
  2704. theme: Theme;
  2705. model: Model;
  2706. undoManager: UndoManager;
  2707. windowManager: WindowManager;
  2708. _beforeUnload: (() => void) | undefined;
  2709. _eventDispatcher: EventDispatcher<NativeEventMap> | undefined;
  2710. _nodeChangeDispatcher: NodeChange;
  2711. _pendingNativeEvents: string[];
  2712. _selectionOverrides: SelectionOverrides;
  2713. _skinLoaded: boolean;
  2714. bindPendingEventDelegates: EditorObservable['bindPendingEventDelegates'];
  2715. toggleNativeEvent: EditorObservable['toggleNativeEvent'];
  2716. unbindAllNativeEvents: EditorObservable['unbindAllNativeEvents'];
  2717. fire: EditorObservable['fire'];
  2718. dispatch: EditorObservable['dispatch'];
  2719. on: EditorObservable['on'];
  2720. off: EditorObservable['off'];
  2721. once: EditorObservable['once'];
  2722. hasEventListeners: EditorObservable['hasEventListeners'];
  2723. constructor(id: string, options: RawEditorOptions, editorManager: EditorManager);
  2724. render(): void;
  2725. focus(skipFocus?: boolean): void;
  2726. hasFocus(): boolean;
  2727. translate(text: Untranslated): TranslatedString;
  2728. getParam<K extends BuiltInOptionType>(name: string, defaultVal: BuiltInOptionTypeMap[K], type: K): BuiltInOptionTypeMap[K];
  2729. getParam<K extends keyof NormalizedEditorOptions>(name: K, defaultVal?: NormalizedEditorOptions[K], type?: BuiltInOptionType): NormalizedEditorOptions[K];
  2730. getParam<T>(name: string, defaultVal: T, type?: BuiltInOptionType): T;
  2731. hasPlugin(name: string, loaded?: boolean): boolean;
  2732. nodeChanged(args?: any): void;
  2733. addCommand<S>(name: string, callback: EditorCommandCallback<S>, scope: S): void;
  2734. addCommand(name: string, callback: EditorCommandCallback<Editor>): void;
  2735. addQueryStateHandler<S>(name: string, callback: (this: S) => boolean, scope?: S): void;
  2736. addQueryStateHandler(name: string, callback: (this: Editor) => boolean): void;
  2737. addQueryValueHandler<S>(name: string, callback: (this: S) => string, scope: S): void;
  2738. addQueryValueHandler(name: string, callback: (this: Editor) => string): void;
  2739. addShortcut(pattern: string, desc: string, cmdFunc: string | [
  2740. string,
  2741. boolean,
  2742. any
  2743. ] | (() => void), scope?: any): void;
  2744. execCommand(cmd: string, ui?: boolean, value?: any, args?: ExecCommandArgs): boolean;
  2745. queryCommandState(cmd: string): boolean;
  2746. queryCommandValue(cmd: string): string;
  2747. queryCommandSupported(cmd: string): boolean;
  2748. show(): void;
  2749. hide(): void;
  2750. isHidden(): boolean;
  2751. setProgressState(state: boolean, time?: number): void;
  2752. load(args?: Partial<SetContentArgs>): string;
  2753. save(args?: Partial<GetContentArgs>): string;
  2754. setContent(content: string, args?: Partial<SetContentArgs>): string;
  2755. setContent(content: AstNode, args?: Partial<SetContentArgs>): AstNode;
  2756. setContent(content: Content, args?: Partial<SetContentArgs>): Content;
  2757. getContent(args: {
  2758. format: 'tree';
  2759. } & Partial<GetContentArgs>): AstNode;
  2760. getContent(args?: Partial<GetContentArgs>): string;
  2761. insertContent(content: string, args?: any): void;
  2762. resetContent(initialContent?: string): void;
  2763. isDirty(): boolean;
  2764. setDirty(state: boolean): void;
  2765. getContainer(): HTMLElement;
  2766. getContentAreaContainer(): HTMLElement;
  2767. getElement(): HTMLElement;
  2768. getWin(): Window;
  2769. getDoc(): Document;
  2770. getBody(): HTMLElement;
  2771. convertURL(url: string, name: string, elm?: string | Element): string;
  2772. addVisual(elm?: HTMLElement): void;
  2773. remove(): void;
  2774. destroy(automatic?: boolean): void;
  2775. uploadImages(): Promise<UploadResult$1[]>;
  2776. _scanForImages(): Promise<BlobInfoImagePair[]>;
  2777. }
  2778. interface UrlObject {
  2779. prefix: string;
  2780. resource: string;
  2781. suffix: string;
  2782. }
  2783. declare type WaitState = 'added' | 'loaded';
  2784. declare type AddOnConstructor<T> = (editor: Editor, url: string) => T;
  2785. interface AddOnManager<T> {
  2786. items: AddOnConstructor<T>[];
  2787. urls: Record<string, string>;
  2788. lookup: Record<string, {
  2789. instance: AddOnConstructor<T>;
  2790. }>;
  2791. get: (name: string) => AddOnConstructor<T> | undefined;
  2792. requireLangPack: (name: string, languages?: string) => void;
  2793. add: (id: string, addOn: AddOnConstructor<T>) => AddOnConstructor<T>;
  2794. remove: (name: string) => void;
  2795. createUrl: (baseUrl: UrlObject, dep: string | UrlObject) => UrlObject;
  2796. load: (name: string, addOnUrl: string | UrlObject) => Promise<void>;
  2797. waitFor: (name: string, state?: WaitState) => Promise<void>;
  2798. }
  2799. interface RangeUtils {
  2800. walk: (rng: Range, callback: (nodes: Node[]) => void) => void;
  2801. split: (rng: Range) => RangeLikeObject;
  2802. normalize: (rng: Range) => boolean;
  2803. expand: (rng: Range, options?: {
  2804. type: 'word';
  2805. }) => Range;
  2806. }
  2807. interface ScriptLoaderSettings {
  2808. referrerPolicy?: ReferrerPolicy;
  2809. }
  2810. interface ScriptLoaderConstructor {
  2811. readonly prototype: ScriptLoader;
  2812. new (): ScriptLoader;
  2813. ScriptLoader: ScriptLoader;
  2814. }
  2815. declare class ScriptLoader {
  2816. static ScriptLoader: ScriptLoader;
  2817. private settings;
  2818. private states;
  2819. private queue;
  2820. private scriptLoadedCallbacks;
  2821. private queueLoadedCallbacks;
  2822. private loading;
  2823. constructor(settings?: ScriptLoaderSettings);
  2824. _setReferrerPolicy(referrerPolicy: ReferrerPolicy): void;
  2825. loadScript(url: string): Promise<void>;
  2826. isDone(url: string): boolean;
  2827. markDone(url: string): void;
  2828. add(url: string): Promise<void>;
  2829. load(url: string): Promise<void>;
  2830. remove(url: string): void;
  2831. loadQueue(): Promise<void>;
  2832. loadScripts(scripts: string[]): Promise<void>;
  2833. }
  2834. declare type TextProcessCallback = (node: Text, offset: number, text: string) => number;
  2835. interface Spot {
  2836. container: Text;
  2837. offset: number;
  2838. }
  2839. interface TextSeeker {
  2840. backwards: (node: Node, offset: number, process: TextProcessCallback, root?: Node) => Spot | null;
  2841. forwards: (node: Node, offset: number, process: TextProcessCallback, root?: Node) => Spot | null;
  2842. }
  2843. interface DomTreeWalkerConstructor {
  2844. readonly prototype: DomTreeWalker;
  2845. new (startNode: Node, rootNode: Node): DomTreeWalker;
  2846. }
  2847. declare class DomTreeWalker {
  2848. private readonly rootNode;
  2849. private node;
  2850. constructor(startNode: Node, rootNode: Node);
  2851. current(): Node | null | undefined;
  2852. next(shallow?: boolean): Node | null | undefined;
  2853. prev(shallow?: boolean): Node | null | undefined;
  2854. prev2(shallow?: boolean): Node | null | undefined;
  2855. private findSibling;
  2856. private findPreviousNode;
  2857. }
  2858. interface Version {
  2859. major: number;
  2860. minor: number;
  2861. }
  2862. interface Env {
  2863. transparentSrc: string;
  2864. documentMode: number;
  2865. cacheSuffix: any;
  2866. container: any;
  2867. canHaveCSP: boolean;
  2868. windowsPhone: boolean;
  2869. browser: {
  2870. current: string | undefined;
  2871. version: Version;
  2872. isEdge: () => boolean;
  2873. isChromium: () => boolean;
  2874. isIE: () => boolean;
  2875. isOpera: () => boolean;
  2876. isFirefox: () => boolean;
  2877. isSafari: () => boolean;
  2878. };
  2879. os: {
  2880. current: string | undefined;
  2881. version: Version;
  2882. isWindows: () => boolean;
  2883. isiOS: () => boolean;
  2884. isAndroid: () => boolean;
  2885. isMacOS: () => boolean;
  2886. isLinux: () => boolean;
  2887. isSolaris: () => boolean;
  2888. isFreeBSD: () => boolean;
  2889. isChromeOS: () => boolean;
  2890. };
  2891. deviceType: {
  2892. isiPad: () => boolean;
  2893. isiPhone: () => boolean;
  2894. isTablet: () => boolean;
  2895. isPhone: () => boolean;
  2896. isTouch: () => boolean;
  2897. isWebView: () => boolean;
  2898. isDesktop: () => boolean;
  2899. };
  2900. }
  2901. interface FakeClipboardItem {
  2902. readonly items: Record<string, any>;
  2903. readonly types: ReadonlyArray<string>;
  2904. readonly getType: <D = any>(type: string) => D | undefined;
  2905. }
  2906. interface FakeClipboard {
  2907. readonly FakeClipboardItem: (items: Record<string, any>) => FakeClipboardItem;
  2908. readonly write: (data: FakeClipboardItem[]) => void;
  2909. readonly read: () => FakeClipboardItem[] | undefined;
  2910. readonly clear: () => void;
  2911. }
  2912. interface FocusManager {
  2913. isEditorUIElement: (elm: Element) => boolean;
  2914. }
  2915. interface EntitiesMap {
  2916. [name: string]: string;
  2917. }
  2918. interface Entities {
  2919. encodeRaw: (text: string, attr?: boolean) => string;
  2920. encodeAllRaw: (text: string) => string;
  2921. encodeNumeric: (text: string, attr?: boolean) => string;
  2922. encodeNamed: (text: string, attr?: boolean, entities?: EntitiesMap) => string;
  2923. getEncodeFunc: (name: string, entities?: string) => (text: string, attr?: boolean) => string;
  2924. decode: (text: string) => string;
  2925. }
  2926. interface IconPack {
  2927. icons: Record<string, string>;
  2928. }
  2929. interface IconManager {
  2930. add: (id: string, iconPack: IconPack) => void;
  2931. get: (id: string) => IconPack;
  2932. has: (id: string) => boolean;
  2933. }
  2934. interface Resource {
  2935. load: <T = any>(id: string, url: string) => Promise<T>;
  2936. add: (id: string, data: any) => void;
  2937. unload: (id: string) => void;
  2938. }
  2939. type TextPatterns_d_Pattern = Pattern;
  2940. type TextPatterns_d_RawPattern = RawPattern;
  2941. type TextPatterns_d_DynamicPatternsLookup = DynamicPatternsLookup;
  2942. type TextPatterns_d_RawDynamicPatternsLookup = RawDynamicPatternsLookup;
  2943. type TextPatterns_d_DynamicPatternContext = DynamicPatternContext;
  2944. type TextPatterns_d_BlockCmdPattern = BlockCmdPattern;
  2945. type TextPatterns_d_BlockPattern = BlockPattern;
  2946. type TextPatterns_d_BlockFormatPattern = BlockFormatPattern;
  2947. type TextPatterns_d_InlineCmdPattern = InlineCmdPattern;
  2948. type TextPatterns_d_InlinePattern = InlinePattern;
  2949. type TextPatterns_d_InlineFormatPattern = InlineFormatPattern;
  2950. declare namespace TextPatterns_d {
  2951. export { TextPatterns_d_Pattern as Pattern, TextPatterns_d_RawPattern as RawPattern, TextPatterns_d_DynamicPatternsLookup as DynamicPatternsLookup, TextPatterns_d_RawDynamicPatternsLookup as RawDynamicPatternsLookup, TextPatterns_d_DynamicPatternContext as DynamicPatternContext, TextPatterns_d_BlockCmdPattern as BlockCmdPattern, TextPatterns_d_BlockPattern as BlockPattern, TextPatterns_d_BlockFormatPattern as BlockFormatPattern, TextPatterns_d_InlineCmdPattern as InlineCmdPattern, TextPatterns_d_InlinePattern as InlinePattern, TextPatterns_d_InlineFormatPattern as InlineFormatPattern, };
  2952. }
  2953. interface Delay {
  2954. setEditorInterval: (editor: Editor, callback: () => void, time?: number) => number;
  2955. setEditorTimeout: (editor: Editor, callback: () => void, time?: number) => number;
  2956. }
  2957. declare type UploadResult = UploadResult$2;
  2958. interface ImageUploader {
  2959. upload: (blobInfos: BlobInfo[], showNotification?: boolean) => Promise<UploadResult[]>;
  2960. }
  2961. declare type ArrayCallback$1<T, R> = (this: any, x: T, i: number, xs: ArrayLike<T>) => R;
  2962. declare type ObjCallback$1<T, R> = (this: any, value: T, key: string, obj: Record<string, T>) => R;
  2963. declare type ArrayCallback<T, R> = ArrayCallback$1<T, R>;
  2964. declare type ObjCallback<T, R> = ObjCallback$1<T, R>;
  2965. declare type WalkCallback<T> = (this: any, o: T, i: string, n: keyof T | undefined) => boolean | void;
  2966. interface Tools {
  2967. is: (obj: any, type?: string) => boolean;
  2968. isArray: <T>(arr: any) => arr is Array<T>;
  2969. inArray: <T>(arr: ArrayLike<T>, value: T) => number;
  2970. grep: {
  2971. <T>(arr: ArrayLike<T> | null | undefined, pred?: ArrayCallback<T, boolean>): T[];
  2972. <T>(arr: Record<string, T> | null | undefined, pred?: ObjCallback<T, boolean>): T[];
  2973. };
  2974. trim: (str: string | null | undefined) => string;
  2975. toArray: <T>(obj: ArrayLike<T>) => T[];
  2976. hasOwn: (obj: any, name: string) => boolean;
  2977. makeMap: (items: ArrayLike<string> | string | undefined, delim?: string | RegExp, map?: Record<string, {}>) => Record<string, {}>;
  2978. each: {
  2979. <T>(arr: ArrayLike<T> | null | undefined, cb: ArrayCallback<T, void | boolean>, scope?: any): boolean;
  2980. <T>(obj: Record<string, T> | null | undefined, cb: ObjCallback<T, void | boolean>, scope?: any): boolean;
  2981. };
  2982. map: {
  2983. <T, R>(arr: ArrayLike<T> | null | undefined, cb: ArrayCallback<T, R>): R[];
  2984. <T, R>(obj: Record<string, T> | null | undefined, cb: ObjCallback<T, R>): R[];
  2985. };
  2986. extend: (obj: Object, ext: Object, ...objs: Object[]) => any;
  2987. walk: <T extends Record<string, any>>(obj: T, f: WalkCallback<T>, n?: keyof T, scope?: any) => void;
  2988. resolve: (path: string, o?: Object) => any;
  2989. explode: (s: string | string[], d?: string | RegExp) => string[];
  2990. _addCacheSuffix: (url: string) => string;
  2991. }
  2992. interface KeyboardLikeEvent {
  2993. shiftKey: boolean;
  2994. ctrlKey: boolean;
  2995. altKey: boolean;
  2996. metaKey: boolean;
  2997. }
  2998. interface VK {
  2999. BACKSPACE: number;
  3000. DELETE: number;
  3001. DOWN: number;
  3002. ENTER: number;
  3003. ESC: number;
  3004. LEFT: number;
  3005. RIGHT: number;
  3006. SPACEBAR: number;
  3007. TAB: number;
  3008. UP: number;
  3009. PAGE_UP: number;
  3010. PAGE_DOWN: number;
  3011. END: number;
  3012. HOME: number;
  3013. modifierPressed: (e: KeyboardLikeEvent) => boolean;
  3014. metaKeyPressed: (e: KeyboardLikeEvent) => boolean;
  3015. }
  3016. interface DOMUtilsNamespace {
  3017. (doc: Document, settings: Partial<DOMUtilsSettings>): DOMUtils;
  3018. DOM: DOMUtils;
  3019. nodeIndex: (node: Node, normalized?: boolean) => number;
  3020. }
  3021. interface RangeUtilsNamespace {
  3022. (dom: DOMUtils): RangeUtils;
  3023. compareRanges: (rng1: RangeLikeObject, rng2: RangeLikeObject) => boolean;
  3024. getCaretRangeFromPoint: (clientX: number, clientY: number, doc: Document) => Range;
  3025. getSelectedNode: (range: Range) => Node;
  3026. getNode: (container: Node, offset: number) => Node;
  3027. }
  3028. interface AddOnManagerNamespace {
  3029. <T>(): AddOnManager<T>;
  3030. language: string | undefined;
  3031. languageLoad: boolean;
  3032. baseURL: string;
  3033. PluginManager: PluginManager;
  3034. ThemeManager: ThemeManager;
  3035. ModelManager: ModelManager;
  3036. }
  3037. interface BookmarkManagerNamespace {
  3038. (selection: EditorSelection): BookmarkManager;
  3039. isBookmarkNode: (node: Node) => boolean;
  3040. }
  3041. interface TinyMCE extends EditorManager {
  3042. geom: {
  3043. Rect: Rect;
  3044. };
  3045. util: {
  3046. Delay: Delay;
  3047. Tools: Tools;
  3048. VK: VK;
  3049. URI: URIConstructor;
  3050. EventDispatcher: EventDispatcherConstructor<any>;
  3051. Observable: Observable<any>;
  3052. I18n: I18n;
  3053. LocalStorage: Storage;
  3054. ImageUploader: ImageUploader;
  3055. };
  3056. dom: {
  3057. EventUtils: EventUtilsConstructor;
  3058. TreeWalker: DomTreeWalkerConstructor;
  3059. TextSeeker: (dom: DOMUtils, isBlockBoundary?: (node: Node) => boolean) => TextSeeker;
  3060. DOMUtils: DOMUtilsNamespace;
  3061. ScriptLoader: ScriptLoaderConstructor;
  3062. RangeUtils: RangeUtilsNamespace;
  3063. Serializer: (settings: DomSerializerSettings, editor?: Editor) => DomSerializer;
  3064. ControlSelection: (selection: EditorSelection, editor: Editor) => ControlSelection;
  3065. BookmarkManager: BookmarkManagerNamespace;
  3066. Selection: (dom: DOMUtils, win: Window, serializer: DomSerializer, editor: Editor) => EditorSelection;
  3067. StyleSheetLoader: (documentOrShadowRoot: Document | ShadowRoot, settings: StyleSheetLoaderSettings) => StyleSheetLoader;
  3068. Event: EventUtils;
  3069. };
  3070. html: {
  3071. Styles: (settings?: StylesSettings, schema?: Schema) => Styles;
  3072. Entities: Entities;
  3073. Node: AstNodeConstructor;
  3074. Schema: (settings?: SchemaSettings) => Schema;
  3075. DomParser: (settings?: DomParserSettings, schema?: Schema) => DomParser;
  3076. Writer: (settings?: WriterSettings) => Writer;
  3077. Serializer: (settings?: HtmlSerializerSettings, schema?: Schema) => HtmlSerializer;
  3078. };
  3079. AddOnManager: AddOnManagerNamespace;
  3080. Annotator: (editor: Editor) => Annotator;
  3081. Editor: EditorConstructor;
  3082. EditorCommands: EditorCommandsConstructor;
  3083. EditorManager: EditorManager;
  3084. EditorObservable: EditorObservable;
  3085. Env: Env;
  3086. FocusManager: FocusManager;
  3087. Formatter: (editor: Editor) => Formatter;
  3088. NotificationManager: (editor: Editor) => NotificationManager;
  3089. Shortcuts: ShortcutsConstructor;
  3090. UndoManager: (editor: Editor) => UndoManager;
  3091. WindowManager: (editor: Editor) => WindowManager;
  3092. DOM: DOMUtils;
  3093. ScriptLoader: ScriptLoader;
  3094. PluginManager: PluginManager;
  3095. ThemeManager: ThemeManager;
  3096. ModelManager: ModelManager;
  3097. IconManager: IconManager;
  3098. Resource: Resource;
  3099. FakeClipboard: FakeClipboard;
  3100. trim: Tools['trim'];
  3101. isArray: Tools['isArray'];
  3102. is: Tools['is'];
  3103. toArray: Tools['toArray'];
  3104. makeMap: Tools['makeMap'];
  3105. each: Tools['each'];
  3106. map: Tools['map'];
  3107. grep: Tools['grep'];
  3108. inArray: Tools['inArray'];
  3109. extend: Tools['extend'];
  3110. walk: Tools['walk'];
  3111. resolve: Tools['resolve'];
  3112. explode: Tools['explode'];
  3113. _addCacheSuffix: Tools['_addCacheSuffix'];
  3114. }
  3115. declare const tinymce: TinyMCE;
  3116. export { AddOnManager, Annotator, AstNode, Bookmark, BookmarkManager, ControlSelection, DOMUtils, Delay, DomParser, DomParserSettings, DomSerializer, DomSerializerSettings, DomTreeWalker, Editor, EditorCommands, EditorEvent, EditorManager, EditorModeApi, EditorObservable, EditorOptions, EditorSelection, Entities, Env, EventDispatcher, EventUtils, EventTypes_d as Events, FakeClipboard, FocusManager, Format_d as Formats, Formatter, GeomRect, HtmlSerializer, HtmlSerializerSettings, I18n, IconManager, Model, ModelManager, NotificationApi, NotificationManager, NotificationSpec, Observable, Plugin, PluginManager, RangeUtils, RawEditorOptions, Rect, Resource, Schema, SchemaSettings, ScriptLoader, Shortcuts, StyleSheetLoader, Styles, TextPatterns_d as TextPatterns, TextSeeker, Theme, ThemeManager, TinyMCE, Tools, URI, Ui_d as Ui, UndoManager, VK, WindowManager, Writer, WriterSettings, tinymce as default };