Skip to main content

@fullstackcraftllc/codevideo-virtual-editor

Classes

VirtualEditor

theme_defined_in: index.js:6

Represents a virtual editor that can be manipulated by a series of actions.

Constructors

new VirtualEditor()

new VirtualEditor(initialCodeLines, actions, verbose): VirtualEditor

theme_defined_in: index.js:7

kind_plural_parameter
initialCodeLines

any

actions

any

verbose

any

theme_returns

VirtualEditor

Properties

actionsApplied

actionsApplied: { name: string; value: any }[]

theme_defined_in: index.js:42

authorActionsApplied

authorActionsApplied: any[]

theme_defined_in: index.js:52

caretPositionHistory

caretPositionHistory: { col: number; row: number }[]

theme_defined_in: index.js:31

codeLines

codeLines: any

theme_defined_in: index.js:41

codeLinesHistory

codeLinesHistory: any[]

theme_defined_in: index.js:29

currentlyHighlightedCode

currentlyHighlightedCode: string

theme_defined_in: index.js:33

editorActionsApplied

editorActionsApplied: { name: string; value: any }[]

theme_defined_in: index.js:45

highlightHistory

highlightHistory: string[][]

theme_defined_in: index.js:34

highlightStartPositionHistory

highlightStartPositionHistory: { col: number; row: number }[]

theme_defined_in: index.js:32

isSaved

isSaved: boolean

theme_defined_in: index.js:35

speechCaptionHistory

speechCaptionHistory: any[]

theme_defined_in: index.js:30

verbose

verbose: any

theme_defined_in: index.js:28

Methods

applyAction()

applyAction(action): any

theme_defined_in: index.js:81

Applies a single action to the virtual editor.

kind_plural_parameter
action

any

The action to apply.

theme_returns

any

The code after the action has been applied. Note the code can be identical to a previous step if the action applied was not a code action.

applyActions()

applyActions(actions): any

theme_defined_in: index.js:70

Applies a series of actions to the virtual editor.

kind_plural_parameter
actions

any

The actions to apply.

theme_returns

any

The code after the actions have been applied.

calculateHighlightedText()

calculateHighlightedText(): any

theme_defined_in: index.js:673

theme_returns

any

clearCurrentHighlightedCode()

clearCurrentHighlightedCode(): void

theme_defined_in: index.js:534

Clears the current highlight code of the virtual editor. (Resets the highlight start row and column to -1)

theme_returns

void

getActionsApplied()

getActionsApplied(): { name: string; value: any }[]

theme_defined_in: index.js:552

Gets the actions applied to the virtual editor.

theme_returns

{ name: string; value: any }[]

The actions applied to the virtual editor.

getAuthorActionsApplied()

getAuthorActionsApplied(): any[]

theme_defined_in: index.js:597

Returns an array of caret positions at each step.

theme_returns

any[]

An array of caret positions at each step.

getCode()

getCode(): any

theme_defined_in: index.js:559

Gets the code after the actions have been applied.

theme_returns

any

The code after the actions have been applied.

getCodeAfterEachStep()

getCodeAfterEachStep(): any[]

theme_defined_in: index.js:618

Gets the code after each step.

theme_returns

any[]

The code after each step.

getCodeAtActionIndex()

getCodeAtActionIndex(actionIndex): any

theme_defined_in: index.js:568

Gets the code at a specific action index that has been applied.

kind_plural_parameter
actionIndex

any

The index of the action to get the code after.

theme_returns

any

The code after the action has been applied.

Throws

An error if the action index is out of bounds.

getCodeLines()

getCodeLines(): any

theme_defined_in: index.js:485

Returns the code lines of the virtual editor.

theme_returns

any

The code lines of the virtual editor.

getCodeLinesHistory()

getCodeLinesHistory(): any[]

theme_defined_in: index.js:590

Returns an array of code lines at each step.

theme_returns

any[]

An array of code lines at each step.

getCurrentCaretPosition()

getCurrentCaretPosition(): { col: number; row: number }

theme_defined_in: index.js:492

Returns the PHYSICAL current caret position of the virtual editor, (1, 1) being the top left of the editor.

theme_returns

{ col: number; row: number }

The PHYSICAL current caret position of the virtual editor, (1, 1) being the top left of the editor.

col

col: number

row

row: number

getCurrentHighlightCoordinates()

getCurrentHighlightCoordinates(): { end: { col: number; row: number }; start: { col: number; row: number } }

theme_defined_in: index.js:502

Returns the PHYSICAL current highlight coordinates of the virtual editor, (1, 1) being the top left of the editor.

theme_returns

{ end: { col: number; row: number }; start: { col: number; row: number } }

The PHYSICAL current highlight coordinates of the virtual editor, (1, 1) being the top left of the editor.

end

end: { col: number; row: number }

end.col

col: number

end.row

row: number

start

start: { col: number; row: number }

start.col

col: number

start.row

row: number

getCurrentHighlightedCode()

getCurrentHighlightedCode(): string

theme_defined_in: index.js:528

Returns the current highlight code of the virtual editor.

theme_returns

string

The current highlight code of the virtual editor.

getDataForAnnotatedFrames()

getDataForAnnotatedFrames(): { actionApplied: { name: string; value: any }; caretPosition: { col: number; row: number }; code: any; highlightedCode: string; highlightStartPosition: { col: number; row: number }; speechCaptions: { speechType: "author-speak-before" | "author-speak-after" | "author-speak-during" | "author-wait"; speechValue: string }[] }[]

theme_defined_in: index.js:640

Gets the data for annotated frames.

theme_returns

{ actionApplied: { name: string; value: any }; caretPosition: { col: number; row: number }; code: any; highlightedCode: string; highlightStartPosition: { col: number; row: number }; speechCaptions: { speechType: "author-speak-before" | "author-speak-after" | "author-speak-during" | "author-wait"; speechValue: string }[] }[]

The data for annotated frames.

getEditorActionsApplied()

getEditorActionsApplied(): { name: string; value: any }[]

theme_defined_in: index.js:611

Gets the editor actions applied.

theme_returns

{ name: string; value: any }[]

The editor actions applied.

getEditorStateAfterEachStep()

getEditorStateAfterEachStep(): { caretPosition: { col: number; row: number }; code: any }[]

theme_defined_in: index.js:625

Gets the editor state after each step.

theme_returns

{ caretPosition: { col: number; row: number }; code: any }[]

The editor state after each step.

getHighlightedCodeAtActionIndex()

getHighlightedCodeAtActionIndex(actionIndex): string

theme_defined_in: index.js:580

Gets the highlighted code at a specific action index that has been applied.

kind_plural_parameter
actionIndex

any

The index of the action to get the highlighted code after.

theme_returns

string

The highlighted code after the action has been applied.

Throws

An error if the action index is out of bounds.

getIsSaved()

getIsSaved(): boolean

theme_defined_in: index.js:521

Returns the isSaved state of the virtual editor.

theme_returns

boolean

The isSaved state of the virtual editor.

getSpeechCaptionHistory()

getSpeechCaptionHistory(): any[]

theme_defined_in: index.js:604

Gets the speech caption history.

theme_returns

any[]

The speech caption history.

setCurrentCaretPosition()

setCurrentCaretPosition(row, column): void

theme_defined_in: index.js:544

Sets the current caret position of the virtual editor.

kind_plural_parameter
row

any

The row to set the caret position to, referenced from (1, 1) being the top left of the editor.

column

any

The column to set the caret position to, referenced from (1, 1) being the top left of the editor.

theme_returns

void

setVerbose()

setVerbose(verbose): void

theme_defined_in: index.js:669

Sets the verbose mode for the virtual editor.

kind_plural_parameter
verbose

any

Whether to enable verbose

theme_returns

void }