The inspector
Premium add-on. This page covers a premium add-on, included in Scriviamo Pro and Pro + Collaboration. See pricing
The inspector is an optional property panel. It follows an editor's selection: it shows the selected node's settings, or the document's when no node is selected. With several nodes selected it shows the settings they share, and a change applies to all of them.
The panel is the inspector add-on, a premium add-on under the Scriviamo Commercial License.
Load dist/addons/scriviamo.inspector.js after the base package, with its stylesheet,
dist/addons/scriviamo.inspector.css. The settings it shows belong to the base package: every
node type describes them with inspectorSections(), with or without the panel, so a node type's
settings work the same in the free edition and can be shown in a panel of your own.
import {Inspector} from "./dist/addons/scriviamo.inspector.js"
let inspector = new Inspector(document.getElementById("inspector"), {
editor: editor,
collapsedSections: ["backgroundimage"]
})
inspector.addEventListener("valueChanged", event => {
console.log(event.detail.item.identifier, event.detail.node)
})
Options and members
| Member | Meaning |
|---|---|
editor option, inspectedEditor | The editor to follow |
collapsedSections option | Identifiers of sections that start collapsed |
tabs option and property | The tabs shown, in order; see Tabs |
class option and property | Extra classes for the inspector element |
enabled | False disables every item |
inspect(node) | Shows a node's settings without selecting it; null shows the document's |
refreshValues() | Rereads every value, after code changed the inspected node |
rebuild() | Rebuilds the sections, after they changed |
destroy() | Removes the inspector from the page |
While the editor is read-only, every item is locked.
The header names what's inspected. For a node inside another, such as a field in a form or a picture in a table, it's a breadcrumb, "Form › Text Area", whose containers select themselves when clicked.
Tabs
Besides Properties, the inspector has a Comments tab while the editor has comments, and a tab for each add-on panel loaded: the outline, accessibility, version history and track changes add-ons each add one. The tabs that fit show on one line, always with the current one, and a triangle at the end of the line lists the rest.
To choose the tabs, and their order, list them by identifier:
new Inspector(element, {editor, tabs: ["properties", "outline", "comments"]})
inspector.tabs = ["properties", "tasks"] // changes them later; null goes back to the default
| Identifier | Tab | From |
|---|---|---|
properties | Properties | The inspector |
comments | Comments, while the editor allows comments or has some | The inspector |
outline | Outline | The outline add-on |
accessibility | Accessibility | The accessibility add-on |
versions | History | The versions add-on |
changes | Changes | The trackchanges add-on |
tasks | Tasks; only when listed, as the Tasks tool has it already | The tasks add-on |
Without the option, the inspector shows Properties, Comments, and every panel that shows by
default. Tabs listed whose add-on isn't loaded are left out. A panel of your own, registered with
Editor.registerPanel, is a tab too, by its identifier; set its showsByDefault to false to show
it only where an inspector lists it.
Events
| Event | detail | When |
|---|---|---|
valueChanged | {node, item} | After the user changes a value; node is null for the document |
heightChanged | the height | When the inspector's height changes |
The settings it shows
The inspector shows the sections each node type describes. See Node settings for the sections and items, and for adding to a node type's settings.