Skip to content

Commit

Permalink
fix(ui): Document QEditor.caret computedProp (#14476)
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufkandemir committed Sep 23, 2022
1 parent 39efb28 commit b4956c0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ui/src/components/editor/QEditor.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,5 +312,14 @@
"__exemption": [ "examples" ]
}
}
},

"computedProps": {
"caret": {
"type": "Object",
"tsType": "QEditorCaret",
"desc": "The current caret state",
"__exemption": [ "examples" ]
}
}
}
1 change: 1 addition & 0 deletions ui/types/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from "./api/qtable";
export * from "./api/qtree";
export * from "./api/quploader";
export * from "./api/qnotify";
export * from "./api/qeditor";
export * from "./api/qloading";
export * from "./api/touchswipe";
export * from "./api/web-storage";
Expand Down
17 changes: 17 additions & 0 deletions ui/types/api/qeditor.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// src/components/editor/editor-caret.js#Caret
// We are not exposing the whole API, just the ones that might be needed outside.
export interface QEditorCaret {
readonly selection: Selection | null;
readonly hasSelection: boolean;
readonly range: Range | null;
readonly parent: Element | null;
readonly blockParent: Element | null;

save(range: Range): void;
restore(range?: Range): void;
savePosition(): void;
restorePosition(length?: number): void;
is(commandId: string, param?: string): boolean;
can(commandId: string): boolean;
apply(commandId: string, param?: string, done?: () => void): boolean;
}

0 comments on commit b4956c0

Please sign in to comment.