schlechtenburg/docs/assets/guide_examples.md.f568382d.js

2 lines
2.7 KiB
JavaScript

var _=Object.defineProperty;var u=Object.getOwnPropertySymbols;var f=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var p=(a,e,t)=>e in a?_(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,l=(a,e)=>{for(var t in e||(e={}))f.call(e,t)&&p(a,t,e[t]);if(u)for(var t of u(e))S.call(e,t)&&p(a,t,e[t]);return a};import{S as d,a as x,b as k,c as y,d as E,e as B,f as w,E as M}from"./chunks/ExampleEditor.08243b7c.js";import{r as h,e as b,f as r,d as s,g as V,h as A,c as W,u as m,b as n,o as j}from"./app.d1307649.js";function C(){const a=h(null),e=h(d.View);return{SchlechtenburgWrapper:b({name:"SchlechtenburgWrapper",props:{availableBlocks:{type:Array,default:()=>[]},block:{type:Object,required:!0},onUpdate:{type:null,default:()=>{}},mode:{type:String,validator(o){return Object.values(d).includes(o)},default:d.Edit}},setup(o){return a.value=l({},o.block),e.value=o.mode,a.value?()=>r(x,{block:a.value,availableBlocks:o.availableBlocks,mode:e.value,onUpdate:c=>{a.value=l({},c)}},null):()=>r("div",{class:"sb-message sb-message_error"},[s("An Error occurred")])}}),getBlock(){return a.value},setBlock(o){a.value=l({},o)},getMode(){return e.value},setMode(o){e.value=o}}}const N=async(a,e)=>{const{SchlechtenburgWrapper:t,getBlock:o,setBlock:c,getMode:v,setMode:g}=C(),i=V(t,l({},e));return i.mount(a),{app:i,getBlock:o,setBlock:c,getMode:v,setMode:g}};var O=b({name:"ExampleStandaloneEditor",setup(){const a=w;return A(async()=>{await N("#example-editor",{block:a,mode:d.Edit,availableBlocks:[k,y,E,B],onUpdate:e=>{console.log("got update",e)}})}),()=>r("div",{id:"example-editor"},null)}});const U=n("h1",{id:"examples",tabindex:"-1"},[s("Examples "),n("a",{class:"header-anchor",href:"#examples","aria-hidden":"true"},"#")],-1),D=n("h2",{id:"as-a-view-component",tabindex:"-1"},[s("As a View Component "),n("a",{class:"header-anchor",href:"#as-a-view-component","aria-hidden":"true"},"#")],-1),P=n("p",null,"This documentation website already uses Vue under the hood, so Schlechtenburg can just imported as any other component:",-1),T=n("h2",{id:"standalone",tabindex:"-1"},[s("Standalone "),n("a",{class:"header-anchor",href:"#standalone","aria-hidden":"true"},"#")],-1),q=n("p",null,[n("code",null,"@schlechtenburg/standalone"),s(" gives you a wrapped version of the editor in case you don't have Vue already installed in your application")],-1),F='{"title":"Examples","description":"","frontmatter":{},"headers":[{"level":2,"title":"As a View Component","slug":"as-a-view-component"},{"level":2,"title":"Standalone","slug":"standalone"}],"relativePath":"guide/examples.md"}',H={},G=Object.assign(H,{setup(a){return(e,t)=>(j(),W("div",null,[U,D,P,r(m(M)),T,q,r(m(O))]))}});export{F as __pageData,G as default};