Build your web apps using Smart UI Library
Smart.Editor - Auto Load/Save
Editor Content State Handling
Smart.Editor's allows to automatically store the content to local storage. The autoSaveInterval property determines the interval between each save. The property accepts numeric values as miliseconds. The default interval value is set to 1000ms (1 second). The content is saved only while the Editor is focused.
The auto save feature is not enabled by default. The autoSave property enables/disabled the feature.
The auto load feature of the Editor allows the user to continue from where he left off after re-opening the page. The autoLoad property determines whether the Editor will automatically load the last saved state.
In order for both property to work the Editor should have an id set.
Methods
Additional methods are available for manually saving or loading the Editor:
- saveState - saves the current state of the Editor to local storage.
- loadState - this method takes one optional argument which represents a previously saved content of the Editor. If not provided, a local storage lookup for a previously saved state of the Editor will be performed.
- clearState - clears any stored state of the Editor from Local storage. (Depending on the id of the Editor)
const editor = document.querySelector('smart-editor');
editor.saveState();
editor.loadState();
editor.clearState();
For AI tooling
Developer Quick Reference
Topic: editor-auto-save Component: Editor Framework: JavaScript
Main methods: saveState(), loadState(), clearState()
Common config keys: (none detected)
Implementation Notes
Compatibility: Modern browsers / Web Components API access pattern: const component = document.querySelector(...) + component.method()
Lifecycle guidance: Initialize configuration first, then invoke imperative API when element is available in DOM.
Common pitfalls:
- Calling methods before element initialization.
- Reassigning large configuration partially without understanding merge behavior.
- Missing required module script import for component type.
Validation checklist:
- Ensure module scripts and CSS are loaded once.
- Keep data schema aligned with columns/series definitions.
- Verify method calls target initialized component instance.