structure
- Description:
- IDE guides structure API methods
- Source:
Members
(static, readonly) ACTION_TYPE :string
- Source:
Properties:
Name | Type | Description |
---|---|---|
FILE |
string | |
PREVIEW |
string | |
TERMINAL |
string | |
HIGHLIGHT |
string | |
VISUALIZER |
string | |
VM |
string | |
VM_TERMINAL |
string | |
EARSKETCH |
string | |
JUPYTER_LAB |
string |
Type:
- string
(static, readonly) ITEM_TYPES :string
- Source:
Properties:
Name | Type | Description |
---|---|---|
CHAPTER |
string | |
SECTION |
string | |
PAGE |
string |
Type:
- string
(static, readonly) LAYOUT :string
- Source:
Properties:
Name | Type | Description |
---|---|---|
L_1_PANEL |
string | |
L_2_PANELS |
string | |
L_3_COLUMNS |
string | |
L_3_CELL |
string | |
L_4_CELL |
string |
Type:
- string
(static, readonly) MEDIA_ACTION_TYPE :string
- Source:
Properties:
Name | Type | Description |
---|---|---|
FILE_OPEN |
string | |
FILE_CLOSE |
string | |
TERMINAL_OPEN |
string | |
TERMINAL_CLOSE |
string | |
RUN_COMMAND |
string | |
HIGHLIGHT |
string | |
CLOSE_ALL |
string | |
PAUSE |
string |
Type:
- string
Methods
(async, static) add(settings, parentopt, indexopt) → {Promise.<codioIDE.guides.structure.GuidesStructureItem>}
- Description:
- Add item to the guides book structure
- Source:
Example
try {
const res = await window.codioIDE.guides.structure.add({type: window.codioIDE.guides.structure.ITEM_TYPES.PAGE, value: 'new content'}, null, 2)
console.log('add item result', res) // returns added item: {id: '...', title: '...', type: '...', children: [...]}
} catch (e) {
console.error(e)
}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
settings |
codioIDE.guides.structure.AddOptions | item settings | |
parent |
string |
<optional> |
parent item id |
index |
number |
<optional> |
index to insert |
Throws:
Will throw an error if the project is not found or guides is not opened
Returns:
- Type
- Promise.<codioIDE.guides.structure.GuidesStructureItem>
(async, static) delete(ids) → {Promise.<void>}
- Description:
- Delete items from the guides book structure
- Source:
Example
try {
await window.codioIDE.guides.structure.delete(['nodeId'])
console.log('remove items done')
} catch (e) {
console.error(e)
}
Parameters:
Name | Type | Description |
---|---|---|
ids |
Array.<string> | item ids |
Throws:
Will throw an error if the project is not found or guides is not opened
Returns:
- Type
- Promise.<void>
(async, static) getStructure() → {Promise.<codioIDE.guides.structure.GuidesStructure>}
- Description:
- Returns guides book structure
- Source:
Example
const structure = await codioIDE.guides.structure.getStructure()
// return guides structure object: {name: '...', children: [{id: '...', title: '...', type: '...', children: [...]}]}
Throws:
Will throw an error if the project is not found
Returns:
- Type
- Promise.<codioIDE.guides.structure.GuidesStructure>
(async, static) update(id, settings) → {Promise.<void>}
- Description:
- Update item in the guides book structure
- Source:
Example
try {
await window.codioIDE.guides.structure.update('nodeId', {
title: 'new title'
})
console.log('item updated')
} catch (e) {
console.error(e)
}
Parameters:
Name | Type | Description |
---|---|---|
id |
string | item id |
settings |
codioIDE.guides.structure.UpdateOptions | item settings |
Throws:
Will throw an error if the project is not found, guides is not opened, id is not a string, settings is not an object
Returns:
- Type
- Promise.<void>
Type Definitions
ActionBase
- Source:
Properties:
Name | Type | Description |
---|---|---|
type |
codioIDE.guides.structure.ACTION_TYPE | action id |
panel |
number | action panel |
Type:
- Object
ActionHighlight
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
reference |
string | reference | |
lines |
string |
<optional> |
lines count |
Type:
ActionPreview
- Source:
Properties:
Name | Type | Description |
---|---|---|
url |
string | url |
Type:
ActionTerminal
- Source:
Properties:
Name | Type | Description |
---|---|---|
command |
string | command |
Type:
ActionWithFile
- Source:
Properties:
Name | Type | Description |
---|---|---|
fileName |
string | file name |
Type:
AddOptions
- Source:
Properties:
Name | Type | Description |
---|---|---|
type |
codioIDE.guides.structure.ITEM_TYPES | item type |
title |
string | title |
Type:
GetResult
- Source:
Properties:
Name | Type | Description |
---|---|---|
structure |
codioIDE.guides.structure.GuidesStructureItem | guides structure item |
settings |
codioIDE.guides.structure.UpdateOptions | null | guides section data |
Type:
- Object
GuidesStructure
- Source:
Properties:
Name | Type | Description |
---|---|---|
name |
string | name, obsolete |
children |
codioIDE.guides.structure.GuidesStructureItem | guides children(chapters, sections, pages) |
Type:
- Object
GuidesStructureItem
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
id |
string | item id | |
title |
string | title | |
pageId |
string |
<optional> |
page id if item has content |
type |
codioIDE.structure.ITEM_TYPES | item type | |
children |
codioIDE.guides.structure.GuidesStructureItem |
<optional> |
children if item is a sections or chapter |
Type:
- Object
MediaActionBase
- Source:
Properties:
Name | Type | Description |
---|---|---|
type |
codioIDE.guides.structure.MEDIA_ACTION_TYPE | action type |
time |
number | time in seconds |
Type:
- Object
MediaActionHighlight
- Source:
Properties:
Name | Type | Description |
---|---|---|
reference |
string | reference |
lines |
number | lines count |
Type:
MediaOptions
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | name | |
source |
string | fileName, should exist into .guides/media folder | |
actions |
Array.<(codioIDE.guides.structure.MediaTabAction|codioIDE.guides.structure.MediaActionBase|codioIDE.guides.structure.MediaActionHighlight)> | actions | |
disabled |
boolean |
<optional> |
disable media |
Type:
- Object
MediaTabAction
- Source:
Properties:
Name | Type | Description |
---|---|---|
fileNameOrCommand |
string | filename or command for terminal |
panel |
number | panel number |
Type:
UpdateOptions
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
title |
string |
<optional> |
title |
layout |
codioIDE.guides.structure.LAYOUT |
<optional> |
layout |
guidesOnLeft |
boolean |
<optional> |
guides on left |
content |
string |
<optional> |
content |
actions |
Array.<(codioIDE.guides.structure.ActionBase|codioIDE.guides.structure.ActionWithFile|codioIDE.guides.structure.ActionPreview|codioIDE.guides.structure.ActionHighlight|codioIDE.guides.structure.ActionTerminal)> |
<optional> |
page actions that will be executed on page open |
showFileTree |
boolean |
<optional> |
show file tree |
showFolders |
Array.<string> |
<optional> |
paths, show only the selected folders in filetree |
closeAllTabs |
boolean |
<optional> |
close terminal session on page open |
closeTerminalSession |
boolean |
<optional> |
close terminal session on page open |
teacherOnly |
boolean |
<optional> |
if true - item will be visible only for teachers |
learningObjectives |
boolean |
<optional> |
learning objectives, for items with content |
media |
codioIDE.guides.structure.MediaOptions |
<optional> |
item media settings, for items with content |
Type:
- Object