-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3474541
commit c9f8bdf
Showing
11 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ coverage/ | |
# Consumers will override this anyway, so don't bother committing | ||
package-lock.json | ||
yarn.lock | ||
!/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import QuillCursors from './quill-cursors/quill-cursors'; | ||
import Cursor from './quill-cursors/cursor'; | ||
import '../assets/quill-cursors.scss'; | ||
export { QuillCursors as default, Cursor }; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/*! | ||
* RangeFix v0.2.10 | ||
* https://github.com/edg2s/rangefix | ||
* | ||
* Copyright 2014-22 Ed Sanders. | ||
* Released under the MIT license | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import IQuillCursorsOptions from './i-quill-cursors-options'; | ||
import IQuillRange from './i-range'; | ||
export default class Cursor { | ||
static readonly CONTAINER_ELEMENT_TAG = "SPAN"; | ||
static readonly SELECTION_ELEMENT_TAG = "SPAN"; | ||
static readonly CURSOR_CLASS = "ql-cursor"; | ||
static readonly SELECTION_CLASS = "ql-cursor-selections"; | ||
static readonly SELECTION_BLOCK_CLASS = "ql-cursor-selection-block"; | ||
static readonly CARET_CLASS = "ql-cursor-caret"; | ||
static readonly CARET_CONTAINER_CLASS = "ql-cursor-caret-container"; | ||
static readonly CONTAINER_HOVER_CLASS = "hover"; | ||
static readonly CONTAINER_NO_POINTER_CLASS = "no-pointer"; | ||
static readonly FLAG_CLASS = "ql-cursor-flag"; | ||
static readonly FLAG_FLIPPED_CLASS = "flag-flipped"; | ||
static readonly NAME_CLASS = "ql-cursor-name"; | ||
static readonly HIDDEN_CLASS = "hidden"; | ||
static readonly NO_DELAY_CLASS = "no-delay"; | ||
readonly id: string; | ||
readonly name: string; | ||
readonly color: string; | ||
range: IQuillRange; | ||
private _el; | ||
private _selectionEl; | ||
private _caretEl; | ||
private _flagEl; | ||
private _hideDelay; | ||
private _hideSpeedMs; | ||
private _positionFlag; | ||
constructor(id: string, name: string, color: string); | ||
build(options: IQuillCursorsOptions): HTMLElement; | ||
show(): void; | ||
hide(): void; | ||
remove(): void; | ||
toggleNearCursor(pointX: number, pointY: number): boolean; | ||
toggleFlag(shouldShow?: boolean): void; | ||
updateCaret(rectangle: ClientRect, container: ClientRect): void; | ||
updateSelection(selections: ClientRect[], container: ClientRect): void; | ||
private _setHoverState; | ||
private _toggleOpenedCursor; | ||
private _getCoordinates; | ||
private _updateCaretFlag; | ||
private _clearSelection; | ||
private _addSelection; | ||
private _selectionBlock; | ||
private _sortByDomPosition; | ||
private _sanitize; | ||
private _serialize; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface ICoordinates { | ||
left: number; | ||
top: number; | ||
right: number; | ||
bottom: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default interface IDelta { | ||
ops: IOp[]; | ||
} | ||
export interface IOp { | ||
insert?: any; | ||
delete?: number; | ||
retain?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export default interface IQuillCursorsOptions { | ||
template?: string; | ||
containerClass?: string; | ||
selectionChangeSource?: string; | ||
hideDelayMs?: number; | ||
hideSpeedMs?: number; | ||
transformOnTextChange?: boolean; | ||
boundsContainer?: HTMLElement; | ||
positionFlag?: (flag: HTMLElement, caretRectangle: ClientRect, container: ClientRect) => void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default interface IQuillRange { | ||
index: number; | ||
length: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import IQuillCursorsOptions from './i-quill-cursors-options'; | ||
import Cursor from './cursor'; | ||
import IQuillRange from './i-range'; | ||
export default class QuillCursors { | ||
static DEFAULTS: IQuillCursorsOptions; | ||
readonly quill: any; | ||
readonly options: IQuillCursorsOptions; | ||
private readonly _cursors; | ||
private readonly _container; | ||
private readonly _boundsContainer; | ||
private _currentSelection; | ||
private _isObserving; | ||
constructor(quill: any, options?: IQuillCursorsOptions); | ||
createCursor(id: string, name: string, color: string): Cursor; | ||
moveCursor(id: string, range: IQuillRange): void; | ||
removeCursor(id: string): void; | ||
update(): void; | ||
clearCursors(): void; | ||
toggleFlag(id: string, shouldShow?: boolean): void; | ||
cursors(): Cursor[]; | ||
private _registerSelectionChangeListeners; | ||
private _registerTextChangeListener; | ||
private _registerDomListeners; | ||
private _handleCursorTouch; | ||
private _registerResizeObserver; | ||
private _updateCursor; | ||
private _indexWithinQuillBounds; | ||
private _leafIsValid; | ||
private _handleTextChange; | ||
private _emitSelection; | ||
private _setDefaults; | ||
private _lineRanges; | ||
private _transformCursors; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare const template: string; | ||
export default template; |