tinymce.d.ts 117 KB

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