Constructor
new Workspace(callbacks)
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callbacks | object | callback functions for workspace actionsProperties
|
- Source
Classes
Methods
_applyHistoryResult(command)
Fires re-render callbacks based on the command's dirtyFlags after undo/redo.
Parameters:
| Name | Type | Description |
|---|---|---|
command | object | | the command returned by history.undo() or history.redo() |
- Source
_mergeParagraphWithHistory(segIdx)
Merges the paragraph containing segIdx with the previous paragraph and pushes undo/redo.
Parameters:
| Name | Type | Description |
|---|---|---|
segIdx | number | index of any segment in the paragraph to merge upward |
- Source
_mergeWithHistory(idxA, idxB)
Merges two adjacent segments and pushes an undo/redo command to history. Use this instead of calling activeProject.mergeSegments() directly.
Parameters:
| Name | Type | Description |
|---|---|---|
idxA | number | index of the earlier segment |
idxB | number | index of the later segment (must equal idxA + 1) |
- Source
_splitParagraphWithHistory(segIdx)
Inserts a paragraph break before the segment at segIdx and pushes an undo/redo command.
Parameters:
| Name | Type | Description |
|---|---|---|
segIdx | number | index of the segment that will start the new paragraph |
- Source
_updateUndoRedoButtons()
Updates the enabled/disabled state of the undo and redo buttons.
- Source
clearWorkspace()
Tears down the current WaveSurfer instance and clears all audio, transcript, speaker, and UI state back to their initial values. Called when switching projects or when a project is deleted/closed.
- Source
closeCtxMenu()
Closes the active context menu
- Source
closeSplitPopup()
Close the active split popup if there is one
- Source
commitProjectName()
Commits the project name from the inline input back to the title span, updates the active project's name in state, and refreshes the sidebar. Called on blur and Enter keydown of the title input.
- Source
enterSplitMode(segIdx, anchorEl)
Opens the split popup for the given segment, closing any existing one first.
Parameters:
| Name | Type | Description |
|---|---|---|
segIdx | number | index of the segment to split |
anchorEl | HTMLElement | element to anchor the popup near |
- Source
hasNext(segIdx) → {boolean}
Returns true if there is a segment after segIdx.
Parameters:
| Name | Type | Description |
|---|---|---|
segIdx | number | the segment index to check |
- Source
Returns:
- Type:
- boolean
hasPrev(segIdx) → {boolean}
Returns true if there is a segment before segIdx.
Parameters:
| Name | Type | Description |
|---|---|---|
segIdx | number | the segment index to check |
- Source
Returns:
- Type:
- boolean
initializeWorkspacePanels()
Constructs the three workspace panels and wires their cross-panel callbacks.
- Source
isLocalMode() → {boolean}
Returns true when the app is running in local (desktop) mode.
- Source
Returns:
- Type:
- boolean
isReadOnly() → {boolean}
Returns true if the active project is in read-only mode.
- Source
Returns:
- Type:
- boolean
isSplitting() → {boolean}
Returns true if a split popup is currently active.
- Source
Returns:
- Type:
- boolean
(async) loadProject(project)
Loads project data from the server uplink and populates the workspace
Parameters:
| Name | Type | Description |
|---|---|---|
project | object | the project to be loaded |
- Source
openEmbedDialog(selTarget)
Opens the EmbedDialog for the given text selection target.
Parameters:
| Name | Type | Description |
|---|---|---|
selTarget | object | selection target from TranscriptPanel#getNativeSelection() |
- Source
openSegmentCtxMenu(x, y, segmentIndex, splitAnchor, linkInfo)
Opens a SegmentContextMenu for the given segment index.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
x | number | left position in viewport pixels | |
y | number | top position in viewport pixels | |
segmentIndex | number | index into the active project's transcript segments | |
splitAnchor | Element | | null | anchor for the split popup; defaults to the transcript segment element |
linkInfo | object | | null | when opening from a link span, provides onEdit/onRemove/onCopy callbacks; null otherwise |
- Source
(async) saveLocalCopy(project) → {Promise.<(FileSystemFileHandle|undefined)>}
Prompts the user for a save location and packages the project as a .wfs archive.
Parameters:
| Name | Type | Description |
|---|---|---|
project | object | the project to save |
- Source
Returns:
the file handle on success, or undefined if cancelled
- Type:
- Promise.<(FileSystemFileHandle|undefined)>
setSelectedSeg(idx)
Sets the selected segment, syncing workspace state, transcript panel, and waveform panel.
Parameters:
| Name | Type | Description |
|---|---|---|
idx | number | segment index, or -1 to clear selection |
- Source
setUploadBusy(busy)
Shows or hides the upload spinner on the workspace header upload button.
Parameters:
| Name | Type | Description |
|---|---|---|
busy | boolean | true to show spinner, false to restore the icon |
- Source
unloadActiveProject()
Unloads the currently active project, alerting user to unsaved changes
- Source
updateProjectServerStatus()
Updates the badge and optional push button in the project title bar to reflect whether the active project is local-only, synced, or has unsynced changes.
- Source
wavesurferInstance() → {object}
Returns the WaveSurfer instance from the waveform panel.
- Source
Returns:
the WaveSurfer instance
- Type:
- object