Editor for Vue
Vue 3 version using Smart custom elements and template refs.
What this topic covers: practical setup, the framework-specific API access pattern, and copy-adapt guidance for the examples in this page.
<script setup>
import { onMounted, ref } from 'vue';
import 'smart-webcomponents/source/styles/smart.default.css';
import 'smart-webcomponents/source/modules/smart.editor.js';
const component = ref();
const componentProps = {
// Copy this topic's JavaScript configuration here.
};
onMounted(() => {
Object.assign(component.value, componentProps);
});
</script>
<template>
<smart-editor ref="component"></smart-editor>
</template>
Use component.value for API methods in this topic.
Build your web apps using Smart UI Library
Smart.Editor - iFrame Mode
iFrame Editor
Smart.Editor's content section can be easily stylied or modifed via CSS or Javascript. However the Editor has an additional iframe mode which places the Editor's content inside an iframe which provides an isolated DOM that does not allow styles and scripts to leak in.
The iframe mode is not enabled by default. A property of type object called iframeSettings that configures the iframe mode with the following settings:
- enabled - determines whether iframe mode is enabled or not.
- attributes - an object that defines attributes for the iframe, for example:
attributes: { height: 500 }All native iframe attributes are supported.
-
resources - an object that determines what styles and scripts should be imported into the
iframe's DOM. For example:
resources: { 'style': { href: 'styles.css' }, 'script': { src: 'index.js', type: 'module' } }The href and src attributes should point to the file location and name.
The type attribute determines whether the JS file should be loaded as a module or not.
For AI tooling
Developer Quick Reference
Topic: editor-iframe-mode Component: Editor Framework: Vue
Main methods: (none detected)
Common config keys: (none detected)
Implementation Notes
Compatibility: Vue 3+ API access pattern: const component = ref() + component.value.method()
Lifecycle guidance: Use template refs with