Skip to main content
Knowledge mapeditor: Does an editor automatically save resources?ArcBlock

You are here. See how this question connects to other ideas.

Select a node to open its page · Expand to read within the map

Knowledge mapFollow a connection. Understand a question.
← AFS and interfaces

One question

editor: Does an editor automatically save resources?

editor supports code or text editing; saving depends on explicit connections.

An editor can show a script with line numbers and syntax information. A change event reports an edit. Persistence requires a correct application save action or connection and a successful operation.

Start with these properties

content supplies the initial text. language selects syntax highlighting; it does not execute the program. readOnly makes the editor read-only and hides its toolbar, while lineNumbers controls the line-number gutter. A read-only display does not replace resource authorization.

change reports edited content, not a successful save.

Read a structural example

From the source registry. This is structural reading material, not a live demo; referenced resources and actions require an application.

json
{
  "id": "code-editor",
  "type": "editor",
  "props": {
    "language": "javascript",
    "content": "console.log(\"hello\");",
    "lineNumbers": true
  },
  "events": {
    "change": {
      "exec": "/files/.actions/save",
      "args": {
        "path": "/src/main.js"
      }
    }
  }
}

The example connects changes to a save action, with args.path naming the target file. The registered change-event payload uses content for the edited text. Initial props.content, the change payload and the save path are different pieces of information; the save handler still needs to receive the content and report its result.

Read the editor reference.

Check your understanding

What does an editor change event establish?

That edited content changed; successful persistence requires checking the write operation.