@creaditor/web-starterkit 1.0.41 → 1.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/1271.creaditor.bundle.js +1 -1
- package/dist/1271.creaditor.bundle.js.gz +0 -0
- package/dist/2655.creaditor.bundle.js +823 -0
- package/dist/2655.creaditor.bundle.js.gz +0 -0
- package/dist/3521.creaditor.bundle.js +2 -2
- package/dist/3521.creaditor.bundle.js.gz +0 -0
- package/dist/3847.creaditor.bundle.js +228 -139
- package/dist/3847.creaditor.bundle.js.gz +0 -0
- package/dist/8547.creaditor.bundle.js +197 -149
- package/dist/8547.creaditor.bundle.js.gz +0 -0
- package/dist/8878.creaditor.bundle.js +1 -1
- package/dist/8878.creaditor.bundle.js.gz +0 -0
- package/dist/creaditor.bundle.js +263 -256
- package/dist/creaditor.bundle.js.gz +0 -0
- package/dist/service-worker.js +1 -1
- package/dist/service-worker.js.gz +0 -0
- package/package.json +1 -1
- package/dist/5909.creaditor.bundle.js +0 -693
- package/dist/5909.creaditor.bundle.js.gz +0 -0
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[8878],{98878(e,t,o){o.d(t,{default:()=>H});var n=o(86319),r=o(61919),a=o(96374);const i={"var(--cdtr-primary)":"--cdtr-primary-contrast","var(--cdtr-secondary)":"--cdtr-secondary-contrast"},c=["headerStyle","contentStyle"];function l(e,t){const o={...e||{},...t||{}};return Object.keys(o).length?o:void 0}function d(e){return!(!e||!e.backgroundColor&&!e.background)}function s(e,t){return{item:l(e&&e.itemStyle,t&&t.itemStyle),header:l(e&&e.headerStyle,t&&t.headerStyle),content:l(e&&e.contentStyle,t&&t.contentStyle)}}function p(e,t,o){const n={...e||{}};c.forEach(e=>{const o={...n[e]||{}};t?o.backgroundColor=t:delete o.backgroundColor,Object.keys(o).length?n[e]=o:delete n[e]});const r={...n.itemStyle||{}};return t&&o?r.color=o:delete r.color,Object.keys(r).length?n.itemStyle=r:delete n.itemStyle,n}function u(e,t,o){if(!e)return"";const n=/var\(/i.test(e)&&"function"==typeof o?o(e):e,r=n?(0,a.w)(t||"#000000",n,4.5):"",c=String(e).replace(/\s+/g,"").toLowerCase(),l=i[c];return l?`var(${l}, ${r||"#FFFFFF"})`:r}function g(e){let t=(e||"000000").toString().trim();return t.startsWith("#")&&(t=t.slice(1)),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?"000000":t}function h(e){const t=e.iconCategory||"Arrows",o=e.iconName||"arrow-down-s-line",n=g(e.iconColor);return`https://img.creaditor.ai/icons/serve/${encodeURIComponent(t)}/${encodeURIComponent(o)}.png?width=40&height=40&color=${n}`}const m={he:{itemsTab:"פריטים",itemsDesc:"פאנלים",arrowTab:"חץ",settingsTab:"הגדרות",settingsDesc:"גודל והתנהגות",panel:e=>`פאנל ${e}`,panelDesc:"שנו סדר, קבעו מצב פתיחה או הסירו פאנל. עריכת הטקסט מתבצעת ישירות על הקנבס.",openDefault:"פתוח כברירת מחדל",openDefaultDesc:"הצג פאנל זה פתוח בטעינת העמוד.",moveUp:"הזז למעלה",moveUpDesc:"העבר פאנל זה מיקום אחד למעלה.",moveDown:"הזז למטה",moveDownDesc:"העבר פאנל זה מיקום אחד למטה.",removePanel:"הסר פאנל",removePanelDesc:"מחק פאנל זה.",addPanel:"הוסף פאנל",addPanelDesc:"הוסף פאנל חדש לאקורדיון.",arrowIcon:"סמל החץ",arrowColor:"צבע החץ",arrowSide:"צד החץ",arrowSideDesc:"באיזה צד של הכותרת יופיע החץ.",arrowAuto:"אוטומטי (לפי כיוון הטקסט)",arrowLeft:"שמאל",arrowRight:"ימין",width:"רוחב",widthDesc:"הרוחב הכולל של האקורדיון.",maxWidth:"רוחב מרבי",maxWidthDesc:"הרוחב המרבי של האקורדיון.",multipleOpen:"מספר פאנלים פתוחים בו-זמנית",singleOpen:"פאנל אחד פתוח בכל פעם",allowMultipleDesc:"קבע האם ניתן לפתוח כמה פאנלים יחד.",borderColor:"צבע גבול",panelBackground:"צבע רקע הפאנל",panelBackgroundDesc:"צובע את הכותרת ואת התוכן של פאנל זה.",globalBackground:"צבע רקע לכל הפאנלים",globalBackgroundDesc:"ברירת המחדל לפאנלים שלא הוגדר להם צבע משלהם.",clearBackground:"הסר רקע",clearBackgroundDesc:"חזרה לפאנל שקוף.",designTab:"עיצוב",designDesc:"גופן, גדלים, צבעים וחץ",fontFamily:"גופן",fontFamilyDesc:"חל על כל הפאנלים באקורדיון.",headings:"כותרות",headingSize:"גודל כותרת",contentHeading:"תוכן",contentSize:"גודל טקסט",textColor:"צבע טקסט",textColorDesc:"חל על כל הפאנלים באקורדיון.",globalTypographyNote:"שינוי כאן חל על כל הפאנלים ומחליף עיצוב שהוגדר על מילים בודדות.",spacing:"מרווחים",gap:"מרווח בין פאנלים",paddingX:"ריווח פנימי אופקי",paddingY:"ריווח פנימי אנכי",dividerHeading:"קו מפריד",showDivider:"הצג קו מפריד",hideDivider:"הסתר קו מפריד",showDividerDesc:"הקו שמפריד בין הפאנלים.",dividerWidth:"עובי הקו",dividerStyle:"סוג הקו",checkmark:" ✓"},en:{itemsTab:"Items",itemsDesc:"Panels",arrowTab:"Arrow",settingsTab:"Settings",settingsDesc:"Size & behavior",panel:e=>`Panel ${e}`,panelDesc:"Reorder, set default state, or remove this panel. Edit its text directly on the canvas.",openDefault:"Open by default",openDefaultDesc:"Show this panel expanded when the page loads.",moveUp:"Move Up",moveUpDesc:"Move this panel one position up.",moveDown:"Move Down",moveDownDesc:"Move this panel one position down.",removePanel:"Remove Panel",removePanelDesc:"Delete this panel.",addPanel:"Add Panel",addPanelDesc:"Add a new panel to the accordion.",arrowIcon:"Arrow icon",arrowColor:"Arrow color",arrowSide:"Arrow side",arrowSideDesc:"Which side of the title the arrow sits on.",arrowAuto:"Auto (follow text direction)",arrowLeft:"Left",arrowRight:"Right",width:"Width",widthDesc:"Overall width of the accordion.",maxWidth:"Max Width",maxWidthDesc:"Maximum width of the accordion.",multipleOpen:"Multiple panels open",singleOpen:"One panel open at a time",allowMultipleDesc:"Toggle whether several panels can be expanded at once.",borderColor:"Border Color",panelBackground:"Panel background",panelBackgroundDesc:"Colors both the header and the content of this panel.",globalBackground:"Background for all panels",globalBackgroundDesc:"The default for panels with no color of their own.",clearBackground:"Remove background",clearBackgroundDesc:"Back to a transparent panel.",designTab:"Design",designDesc:"Font, sizes, colors & arrow",fontFamily:"Font",fontFamilyDesc:"Applies to every panel in the accordion.",headings:"Headings",headingSize:"Heading size",contentHeading:"Content",contentSize:"Text size",textColor:"Text color",textColorDesc:"Applies to every panel in the accordion.",globalTypographyNote:"Changing these restyles every panel and replaces formatting set on individual words.",spacing:"Spacing",gap:"Gap between panels",paddingX:"Horizontal padding",paddingY:"Vertical padding",dividerHeading:"Divider",showDivider:"Show divider",hideDivider:"Hide divider",showDividerDesc:"The line separating the panels.",dividerWidth:"Divider thickness",dividerStyle:"Divider style",checkmark:" ✓"}};let y=null;function f(e){let{component:t,commands:o}=e;const a=function(){try{return"en"!==n.M.get("config","language")}catch(e){return!1}}()?m.he:m.en,i=Array.isArray(t.props.items)?t.props.items:[],c=t.props.style||{},l=t.accordion||{},d=!1!==t.props.allowMultiple,p=!1!==t.props.showDivider,u=(e,o)=>{const n=function(e,t){const o=s(e,t);return o.header&&o.header.backgroundColor||o.content&&o.content.backgroundColor||""}(t.props,e);return[{type:"colorpicker",title:a.panelBackground,description:a.panelBackgroundDesc,alpha:!1,value:n||"#ffffff",onChange:e=>l.setPanelBackground&&l.setPanelBackground(o,e.target.value)},{type:"option",text:a.clearBackground,description:a.clearBackgroundDesc,active:!!n,onClick:()=>l.setPanelBackground&&l.setPanelBackground(o,"")}]},f=i.map((e,t)=>({type:"accordion",label:a.panel(t+1),isOpen:!1,description:a.panelDesc,onToggle:()=>{},children:[{type:"option",text:e.isOpen?a.openDefault+a.checkmark:a.openDefault,description:a.openDefaultDesc,active:!0,onClick:()=>l.setDefaultOpen&&l.setDefaultOpen(t,!e.isOpen)},{type:"option",text:a.moveUp,description:a.moveUpDesc,active:t>0,onClick:()=>l.moveItem&&l.moveItem(t,t-1)},{type:"option",text:a.moveDown,description:a.moveDownDesc,active:t<i.length-1,onClick:()=>l.moveItem&&l.moveItem(t,t+1)},{type:"divider"},...u(e,t),{type:"divider"},{type:"option",text:a.removePanel,icon:"remove",color:"red",description:a.removePanelDesc,onClick:()=>l.removeItem&&l.removeItem(t)},{type:"divider"}]})),v=()=>t.props.arrowSide||"auto",w=()=>[{value:"auto",label:a.arrowAuto},{value:"left",label:a.arrowLeft},{value:"right",label:a.arrowRight}],C=()=>{const e=v(),t=w().find(t=>t.value===e);return t?t.label:a.arrowAuto},x=(e,n,r)=>{const a=parseInt(e.target.value,10);var i;a&&a!==t.props[n]&&(o.execCommand(n,a),i=()=>r&&r(a),clearTimeout(y),y=setTimeout(i,200))},b=e=>x(e,"headingFontSize",l.setHeadingFontSize),D=e=>x(e,"contentFontSize",l.setContentFontSize);return{tabs:e=>{const t=[{text:a.itemsTab,description:a.itemsDesc},{text:a.designTab,description:a.designDesc},{text:a.settingsTab,description:a.settingsDesc}];return t.forEach(t=>{t.selected=t.text===e}),t},layout:e=>{let{tab:n}=e;return n.text===a.designTab?[{type:"info",text:a.globalTypographyNote},{type:"fontFamily",title:a.fontFamily,description:a.fontFamilyDesc,value:t.props.fontFamily||"Arial",onChange:e=>{o.execCommand("fontFamily",e.target.name||e.target.value),l.setFontFamily&&l.setFontFamily(e.target.value)}},{type:"divider"},{type:"heading",level:4,text:a.headings},{type:"slider",title:a.headingSize,unit:"px",min:8,max:72,value:t.props.headingFontSize||16,onInput:e=>b(e),onChange:e=>b(e)},{type:"divider"},{type:"heading",level:4,text:a.contentHeading},{type:"slider",title:a.contentSize,unit:"px",min:8,max:72,value:t.props.contentFontSize||14,onInput:e=>D(e),onChange:e=>D(e)},{type:"divider"},{type:"colorpicker",title:a.textColor,description:a.textColorDesc,alpha:!1,value:t.props.textColor||"#000000",onChange:e=>{o.execCommand("textColor",e.target.value),l.setTextColor&&l.setTextColor(e.target.value)}},{type:"divider"},{type:"heading",level:4,text:a.arrowTab},{type:"icons",title:a.arrowIcon,useIconsApi:!0,selectedIcon:h(t.props),iconColor:g(t.props.iconColor),iconSize:24,onChange:e=>{const n=e.detail;if(!n)return;null!=n.category&&null!=n.name&&(o.execCommand("iconCategory",n.category),o.execCommand("iconName",n.name));const r=(null!=n.color?n.color:t.props.iconColor||"000000").toString().replace(/^#/,"");o.execCommand("iconColor",r)}},{type:"colorpicker",title:a.arrowColor,alpha:!1,value:t.props.iconColor?t.props.iconColor.startsWith("#")?t.props.iconColor:"#"+t.props.iconColor:"#000000",onChange:e=>{o.execCommand("iconColor",(0,r.A)(e.target.value).toHex())}},{type:"dropdown",title:a.arrowSide,description:a.arrowSideDesc,value:C(),selected:v(),items:w(),onChange:e=>{let{target:t}=e;return o.execCommand("arrowSide",t.value)}}]:n.text===a.settingsTab?[{type:"input",title:a.width,description:a.widthDesc,value:c.width||"",onInput:e=>{let{target:t}=e;return o.execCommand("style",{width:t.value})}},{type:"input",title:a.maxWidth,description:a.maxWidthDesc,value:c.maxWidth||"",onInput:e=>{let{target:t}=e;return o.execCommand("style",{maxWidth:t.value})}},{type:"option",text:d?a.multipleOpen+a.checkmark:a.singleOpen,description:a.allowMultipleDesc,active:!0,onClick:()=>o.execCommand("allowMultiple",!d)},{type:"colorpicker",title:a.borderColor,alpha:!1,value:t.props.borderColor||"#e6e6e6",onChange:e=>o.execCommand("borderColor",e.target.value)},{type:"divider"},{type:"colorpicker",title:a.globalBackground,description:a.globalBackgroundDesc,alpha:!1,value:t.props.headerStyle&&t.props.headerStyle.backgroundColor||"#ffffff",onChange:e=>l.setGlobalBackground&&l.setGlobalBackground(e.target.value)},{type:"option",text:a.clearBackground,description:a.clearBackgroundDesc,active:!(!t.props.headerStyle||!t.props.headerStyle.backgroundColor),onClick:()=>l.setGlobalBackground&&l.setGlobalBackground("")},{type:"divider"},{type:"heading",level:4,text:a.spacing},{type:"slider",title:a.gap,unit:"px",min:0,max:60,value:parseInt(t.props.gap,10)||0,onInput:e=>{let{target:t}=e;return o.execCommand("gap",`${t.value}px`)}},{type:"slider",title:a.paddingX,unit:"px",min:0,max:60,value:parseInt(t.props.paddingX,10)||(i.some(e=>e.headerStyle&&e.headerStyle.backgroundColor||e.contentStyle&&e.contentStyle.backgroundColor||t.props.headerStyle&&t.props.headerStyle.backgroundColor)?16:4),onInput:e=>{let{target:t}=e;return o.execCommand("paddingX",`${t.value}px`)}},{type:"slider",title:a.paddingY,unit:"px",min:0,max:60,value:parseInt(t.props.paddingY,10)||14,onInput:e=>{let{target:t}=e;return o.execCommand("paddingY",`${t.value}px`)}},{type:"divider"},{type:"heading",level:4,text:a.dividerHeading},{type:"option",text:p?a.showDivider+a.checkmark:a.hideDivider,description:a.showDividerDesc,active:!0,onClick:()=>o.execCommand("showDivider",!p)},{type:"slider",title:a.dividerWidth,unit:"px",min:0,max:10,value:parseInt(t.props.dividerWidth,10)||1,onInput:e=>{let{target:t}=e;return o.execCommand("dividerWidth",`${t.value}px`)}},{type:"dropdown",title:a.dividerStyle,value:t.props.dividerStyle||"solid",selected:t.props.dividerStyle||"solid",items:[{value:"solid"},{value:"dashed"},{value:"dotted"},{value:"double"}],onChange:e=>{let{target:t}=e;return o.execCommand("dividerStyle",t.value)}}]:[...f,{type:"option",text:a.addPanel,icon:"add",description:a.addPanelDesc,onClick:()=>l.addItem&&l.addItem()}]}}}function v(e){let{helpers:t,controller:o}=e;return{set:(e,n,r)=>{switch(n){case"style":return e[n]=t.deepMerge(e[n]||{},r),o.applyStyle(),!0;case"items":return!!Array.isArray(r)&&(e[n]=r,o.reconcile(r),!0);case"headerStyle":case"contentStyle":case"itemStyle":case"gap":case"paddingX":case"paddingY":case"showDivider":case"dividerWidth":case"dividerStyle":case"arrowSide":return e[n]=r,o.applyItemStyles(),!0;case"fontFamily":case"headingFontSize":case"contentFontSize":case"textColor":case"allowMultiple":return e[n]=r,!0;case"borderColor":return e[n]=r,o.applyStyle(),!0;case"iconCategory":case"iconName":case"iconColor":return e[n]=r,o.refreshArrows(),!0;default:return!1}}}}var w=o(84488),C=o.n(w);const x="cdtr-accordion-styles",b=[];let D=!1,S=null;function k(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function A(e,t){if(!e)return;(e.__cdtrAppliedStyleKeys||[]).forEach(t=>e.style.removeProperty(t));const o=[];for(const n in t||{})Object.prototype.hasOwnProperty.call(t,n)&&(e.style.setProperty(k(n),t[n]),o.push(k(n)));e.__cdtrAppliedStyleKeys=o}function E(e){const t=e.iconCategory||"Arrows",o=e.iconName||"arrow-down-s-line",n=function(e){let t=(e||"000000").toString().trim();return t.startsWith("#")&&(t=t.slice(1)),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?"000000":t}(e.iconColor);return`${`https://img.creaditor.ai/icons/serve/${encodeURIComponent(t)}/${encodeURIComponent(o)}.png`}?${new URLSearchParams({width:"40",height:"40",color:n}).toString()}`}function F(e){const t=B();return{type:"doc",content:[{type:"paragraph",attrs:{lineHeight:"1.4",direction:t?"rtl":"ltr",textAlign:t?"right":"left"},content:e?[{type:"text",text:String(e)}]:[]}]}}function B(){try{return"en"!==n.M.get("config","language")}catch(e){return!1}}function O(e){if(!e||"string"!=typeof e)return;const t="$%^$%^";if(0===e.replace(/[^\P{L}a-z][^a-z]*/giu,t).indexOf(t))return!0;const o=e.replace(/[0-9]/g,"").replace(/\n/g,"");return/^[\u0590-\u05FF ,.,!,?,/,*,#,@,&,(,)'-]+$/i.test(o)}function I(e){let t="";const o=e=>{e&&("string"==typeof e.text&&(t+=e.text+" "),Array.isArray(e.content)&&e.content.forEach(o))};return e&&Array.isArray(e.content)&&e.content.forEach(o),t}const T={title:"label",content:"description"};function P(e,t){const o=e||{};return function(e){return e&&"object"==typeof e&&e.childNodes?{childNodes:e.childNodes}:{childNodes:F("string"==typeof e?e:"")}}(null!=o[t]?o[t]:o[T[t]])}function N(e){const t=e&&"object"==typeof e?{...e}:{};return delete t.label,delete t.description,{...t,title:P(e,"title"),content:P(e,"content"),isOpen:!(!e||!e.isOpen)}}const z=[8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,40,44,48,56,64,72];function M(e){return[{type:"fontFamily",fonts:e||[],useCloud:!0},{type:"fontSize",sizes:z},{type:"bold"},{type:"italic"},{type:"underline"},{type:"fontColor"},{type:"backcolor"},{type:"direction"},{type:"left"},{type:"center"},{type:"right"},{type:"clearFormat"}]}function $(e){return[{type:"fontFamily",fonts:e||[],useCloud:!0},{type:"fontSize",sizes:z},{type:"bold"},{type:"italic"},{type:"underline"},{type:"strike"},{type:"fontColor"},{type:"backcolor"},{type:"bullet"},{type:"numbered"},{type:"link"},{type:"unLink"},{type:"direction"},{type:"left"},{type:"center"},{type:"right"},{type:"clearFormat"}]}const H=()=>{const e="accordion";return{name:e,create:t=>{const{createElement:o,compose:r,helpers:a}=t,i=document.createElement("div");i.classList.add("cdtr-acc-root"),function(e){if(!e||!e.head||e.getElementById(x))return;const t=e.createElement("style");t.id=x,t.textContent='\n.cdtr-acc-root { display: block; }\n.cdtr-acc-item {\n border-bottom: var(--cdtr-acc-border-width, 1px)\n var(--cdtr-acc-border-style, solid) var(--cdtr-acc-border, #e6e6e6);\n}\n/* Adjacent-sibling so the gap never adds a stray margin above the first panel.\n A legacy per-item itemStyle.marginTop is inline and still overrides this. */\n.cdtr-acc-item + .cdtr-acc-item { margin-top: var(--cdtr-acc-gap, 0); }\n.cdtr-acc-header {\n display: flex; align-items: center; justify-content: space-between;\n gap: 12px; cursor: pointer;\n padding: var(--cdtr-acc-pad-y, 14px) var(--cdtr-acc-pad-x, 4px);\n}\n.cdtr-acc-title-host { flex: 1 1 auto; min-width: 0; font-weight: 600; }\n.cdtr-acc-arrow {\n flex: 0 0 auto; width: 20px; height: 20px; user-select: none;\n transition: transform .3s ease; pointer-events: none;\n}\n.cdtr-acc-item.is-open > .cdtr-acc-header .cdtr-acc-arrow { transform: rotate(180deg); }\n/* Order works along the flex main axis, which already follows the item\'s dir,\n so "start" is the left in LTR and the right in RTL. That is what lets one\n rule serve both an explicit side and either reading direction. */\n.cdtr-acc-item.cdtr-acc-arrow-start > .cdtr-acc-header .cdtr-acc-arrow { order: -1; }\n.cdtr-acc-panel {\n display: grid; grid-template-rows: 0fr;\n transition: grid-template-rows .3s ease;\n}\n.cdtr-acc-item.is-open > .cdtr-acc-panel { grid-template-rows: 1fr; }\n.cdtr-acc-panel-inner { overflow: hidden; min-height: 0; }\n.cdtr-acc-content-host {\n padding: 4px var(--cdtr-acc-pad-x, 4px) var(--cdtr-acc-pad-y, 14px);\n}\n',e.head.appendChild(t)}(i.ownerDocument||document);let l=n.M.get("config","target");"string"==typeof l&&(l=document.querySelector(l)),l||(l=document.body);const g=n.M.get("config","editor","configure","editorProps","fonts");let h=[],m=null,y=!1,w=!1,k=null;const F=()=>Array.isArray(r.props.items)?r.props.items:[],T=()=>F().map(e=>N(e)),z=()=>{const e=r.props.style||{};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i.style[t]=e[t]);r.props.borderColor&&i.style.setProperty("--cdtr-acc-border",r.props.borderColor)},H=()=>{const e=F();let t=!1;h.forEach((o,n)=>{const a=s(r.props,e[n]),i=function(e){return d(e.header)||d(e.content)||d(e.item)}(a);i&&(t=!0);const c=function(e){const t=O(I(P(e,"title").childNodes)),o=void 0===t?O(I(P(e,"content").childNodes)):t;return void 0===o?B()?"rtl":"ltr":o?"rtl":"ltr"}(e[n]);o.node.getAttribute("dir")!==c&&o.node.setAttribute("dir",c),o.node.classList.toggle("cdtr-acc-arrow-start",function(e,t){return"left"===e?"ltr"===t:"right"===e&&"rtl"===t}(r.props.arrowSide,c)),A(o.node,{...!0!==r.props.showDivider&&i?{borderBottom:"none"}:{},...a.item||{},direction:c}),A(o.header,a.header),A(o.contentHost,a.content)}),(e=>{const t=r.props,o=(e,t)=>{null==t||""===t?i.style.removeProperty(e):i.style.setProperty(e,t)};o("--cdtr-acc-gap",t.gap),o("--cdtr-acc-pad-y",t.paddingY),o("--cdtr-acc-pad-x",t.paddingX||(e?"16px":"")),o("--cdtr-acc-border-width",!1===t.showDivider?"0":t.dividerWidth),o("--cdtr-acc-border-style",t.dividerStyle)})(t)},W=function(e){let{structural:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};k&&(y=t,k.commands.execCommand("items",e),y=!1)},L=(e,t,o)=>{const n=P(F()[o],t).childNodes,r=C()({element:e,container:l||document.body,editable:!0,offsetTop:40,defaultDirection:B()?"rtl":"ltr",content:n,ignoresBlurByQuerySelectors:[".ignore-events"],builder:"title"===t?M(g):$(g),onFocus:()=>{if(!D||S===r||null===S){if(D=!0,S=r,m={index:o,field:t},b.length>0)for(b.forEach(e=>{e!==r&&e.hideEditor()});b.length>0;)b.pop();b.push(r),setTimeout(()=>{S===r&&D&&r.showEditor()},100)}},onBlur:()=>{m&&m.index===o&&m.field===t&&(m=null),S===r&&(S=null),setTimeout(()=>{S!==r&&(D=!1)},150)},onUpdate:e=>{let{editor:n,transaction:r}=e;if(0===r.steps.length||w)return;m={index:o,field:t};const a=T();a[o]&&(a[o][t]={childNodes:n.getJSON()},W(a))}});return r},R=e=>{const t=F()[e],o=document.createElement("div");o.className="cdtr-acc-item",t&&t.isOpen&&o.classList.add("is-open");const n=document.createElement("div");n.className="cdtr-acc-header";const a=document.createElement("div");a.className="cdtr-acc-title-host";const i=document.createElement("img");i.className="cdtr-acc-arrow",i.alt="",i.setAttribute("draggable","false"),i.src=E(r.props),n.append(a,i);const c=document.createElement("div");c.className="cdtr-acc-panel";const l=document.createElement("div");l.className="cdtr-acc-panel-inner";const d=document.createElement("div");return d.className="cdtr-acc-content-host",l.appendChild(d),c.appendChild(l),o.append(n,c),n.addEventListener("click",t=>{a.contains(t.target)||function(e){const t=!1!==r.props.allowMultiple,o=T();if(!o[e])return;const n=!o[e].isOpen;o.forEach((o,r)=>{o.isOpen=t?r===e?n:o.isOpen:r===e&&n}),h.forEach((e,t)=>{e.node&&e.node.classList.toggle("is-open",!!o[t].isOpen)}),W(o,{structural:!0})}(e)}),{itemNode:o,header:n,arrow:i,titleHost:a,panelInner:l,contentHost:d}},U=()=>{h.forEach(e=>{try{e.title&&e.title.hideEditor&&e.title.hideEditor(),e.content&&e.content.hideEditor&&e.content.hideEditor()}catch(e){}}),h=[]},j=()=>{U(),i.innerHTML="",F().forEach((e,t)=>{const{itemNode:o,header:n,arrow:r,titleHost:a,panelInner:c,contentHost:l}=R(t);i.appendChild(o);const d=L(a,"title",t);a.parentElement!==n&&n.insertBefore(a,r);const s=L(l,"content",t);l.parentElement!==c&&c.appendChild(l),h.push({title:d,content:s,node:o,header:n,contentHost:l})}),H()};const X=e=>t=>{const o=e&&e.ownerDocument||document,n=o.defaultView||window,r=o.createElement("span");r.style.cssText="display:none",r.style.color=t,(e||o.body).appendChild(r);const a=n.getComputedStyle(r).color;return r.remove(),a||""},Y=e=>{if(!e)return"";return((e.ownerDocument||document).defaultView||window).getComputedStyle(e).color||""},G=(e,t)=>{if(!h.length)return;w=!0;try{h.forEach(o=>{e.forEach(e=>{const n=o[e];if(n)try{n.chain().setMeta("addToHistory",!1).selectAll().setMark("textStyle",t).run()}catch(e){}})})}finally{w=!1}m=null;const o=T();h.forEach((t,n)=>{o[n]&&e.forEach(e=>{const r=t[e];r&&(o[n][e]={childNodes:r.getJSON()})})}),W(o,{structural:!0})},J=["title","content"],_={reconcile:e=>{!y&&Array.isArray(e)&&(e.length===h.length?(e.forEach((e,t)=>{["title","content"].forEach(o=>{const n=h[t]&&h[t][o],r=P(e,o).childNodes;if(n&&r&&(!m||m.index!==t||m.field!==o))try{JSON.stringify(n.getJSON())!==JSON.stringify(r)&&n.chain().setContent(r).run()}catch(e){}});const o=h[t]&&h[t].node;o&&o.classList.toggle("is-open",!!e.isOpen)}),H()):j())},applyStyle:z,refreshArrows:()=>{const e=E(r.props);h.forEach(t=>{const o=t.node&&t.node.querySelector(".cdtr-acc-arrow");o&&(o.src=e)})},applyItemStyles:H};return j(),z(),k=o({name:e,id:r.id,template:i,defaultProps:{style:{},items:[],allowMultiple:!0,iconCategory:"Arrows",iconName:"arrow-down-s-line",iconColor:"000000"},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>i,handleBar:!0,validator:v({helpers:a,controller:_}),schema:r.schema,onSelect:e=>i.classList.add(e),onDeselect:e=>i.classList.remove(e),elementProps:r,remove:()=>{U(),i.remove()},createEditor:f}),k.addProp("accordion",{addItem:()=>{const e=T(),t=e.length+1,o=B();e.push(N({title:o?`כותרת ${t}`:`Accordion title ${t}`,content:o?`תוכן הסעיף ${t}`:`Accordion content ${t}`})),W(e,{structural:!0}),j()},removeItem:e=>{const t=T();e<0||e>=t.length||(t.splice(e,1),W(t,{structural:!0}),j())},moveItem:(e,t)=>{const o=T();if(t<0||t>=o.length||e<0||e>=o.length)return;const[n]=o.splice(e,1);o.splice(t,0,n),W(o,{structural:!0}),j()},setDefaultOpen:(e,t)=>{const o=T();o[e]&&(o[e].isOpen=!!t,t&&!1===r.props.allowMultiple&&o.forEach((t,o)=>{o!==e&&(t.isOpen=!1)}),h.forEach((e,t)=>{e.node&&e.node.classList.toggle("is-open",!!o[t].isOpen)}),W(o,{structural:!0}))},setPanelBackground:(e,t)=>{const o=T();if(!o[e])return;const n=h[e]&&h[e].node||i;o[e]=p(o[e],t,u(t,Y(n),X(n))),W(o,{structural:!0}),H()},setGlobalBackground:e=>{if(!k)return;const t=p(r.props,e,u(e,Y(i),X(i)));[...c,"itemStyle"].forEach(e=>{k.commands.execCommand(e,t[e]||{})}),H()},setFontFamily:e=>G(J,{fontFamily:e}),setHeadingFontSize:e=>G(["title"],{fontSize:`${e}px`}),setContentFontSize:e=>G(["content"],{fontSize:`${e}px`}),setTextColor:e=>G(J,{color:e})}),k}}}}}]);
|
|
1
|
+
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[8878],{98878(e,t,o){o.d(t,{default:()=>H});var n=o(86319),r=o(61919),a=o(96374);const i={"var(--cdtr-primary)":"--cdtr-primary-contrast","var(--cdtr-secondary)":"--cdtr-secondary-contrast"},c=["headerStyle","contentStyle"];function l(e,t){const o={...e||{},...t||{}};return Object.keys(o).length?o:void 0}function d(e){return!(!e||!e.backgroundColor&&!e.background)}function s(e,t){return{item:l(e&&e.itemStyle,t&&t.itemStyle),header:l(e&&e.headerStyle,t&&t.headerStyle),content:l(e&&e.contentStyle,t&&t.contentStyle)}}function p(e,t,o){const n={...e||{}};c.forEach(e=>{const o={...n[e]||{}};t?o.backgroundColor=t:delete o.backgroundColor,Object.keys(o).length?n[e]=o:delete n[e]});const r={...n.itemStyle||{}};return t&&o?r.color=o:delete r.color,Object.keys(r).length?n.itemStyle=r:delete n.itemStyle,n}function u(e,t,o){if(!e)return"";const n=/var\(/i.test(e)&&"function"==typeof o?o(e):e,r=n?(0,a.w)(t||"#000000",n,4.5):"",c=String(e).replace(/\s+/g,"").toLowerCase(),l=i[c];return l?`var(${l}, ${r||"#FFFFFF"})`:r}function g(e){let t=(e||"000000").toString().trim();return t.startsWith("#")&&(t=t.slice(1)),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?"000000":t}function h(e){const t=e.iconCategory||"Arrows",o=e.iconName||"arrow-down-s-line",n=g(e.iconColor);return`https://img.creaditor.ai/icons/serve/${encodeURIComponent(t)}/${encodeURIComponent(o)}.png?width=40&height=40&color=${n}`}const m={he:{itemsTab:"פריטים",itemsDesc:"פאנלים",arrowTab:"חץ",settingsTab:"הגדרות",settingsDesc:"גודל והתנהגות",panel:e=>`פאנל ${e}`,panelDesc:"שנו סדר, קבעו מצב פתיחה או הסירו פאנל. עריכת הטקסט מתבצעת ישירות על הקנבס.",openDefault:"פתוח כברירת מחדל",openDefaultDesc:"הצג פאנל זה פתוח בטעינת העמוד.",moveUp:"הזז למעלה",moveUpDesc:"העבר פאנל זה מיקום אחד למעלה.",moveDown:"הזז למטה",moveDownDesc:"העבר פאנל זה מיקום אחד למטה.",removePanel:"הסר פאנל",removePanelDesc:"מחק פאנל זה.",addPanel:"הוסף פאנל",addPanelDesc:"הוסף פאנל חדש לאקורדיון.",arrowIcon:"סמל החץ",arrowColor:"צבע החץ",arrowSide:"צד החץ",arrowSideDesc:"באיזה צד של הכותרת יופיע החץ.",arrowAuto:"אוטומטי (לפי כיוון הטקסט)",arrowLeft:"שמאל",arrowRight:"ימין",width:"רוחב",widthDesc:"הרוחב הכולל של האקורדיון.",maxWidth:"רוחב מרבי",maxWidthDesc:"הרוחב המרבי של האקורדיון.",multipleOpen:"מספר פאנלים פתוחים בו-זמנית",singleOpen:"פאנל אחד פתוח בכל פעם",allowMultipleDesc:"קבע האם ניתן לפתוח כמה פאנלים יחד.",borderColor:"צבע גבול",panelBackground:"צבע רקע הפאנל",panelBackgroundDesc:"צובע את הכותרת ואת התוכן של פאנל זה.",globalBackground:"צבע רקע לכל הפאנלים",globalBackgroundDesc:"ברירת המחדל לפאנלים שלא הוגדר להם צבע משלהם.",clearBackground:"הסר רקע",clearBackgroundDesc:"חזרה לפאנל שקוף.",designTab:"עיצוב",designDesc:"גופן, גדלים, צבעים וחץ",fontFamily:"גופן",fontFamilyDesc:"חל על כל הפאנלים באקורדיון.",headings:"כותרות",headingSize:"גודל כותרת",contentHeading:"תוכן",contentSize:"גודל טקסט",textColor:"צבע טקסט",textColorDesc:"חל על כל הפאנלים באקורדיון.",globalTypographyNote:"שינוי כאן חל על כל הפאנלים ומחליף עיצוב שהוגדר על מילים בודדות.",spacing:"מרווחים",gap:"מרווח בין פאנלים",paddingX:"ריווח פנימי אופקי",paddingY:"ריווח פנימי אנכי",dividerHeading:"קו מפריד",showDivider:"הצג קו מפריד",hideDivider:"הסתר קו מפריד",showDividerDesc:"הקו שמפריד בין הפאנלים.",dividerWidth:"עובי הקו",dividerStyle:"סוג הקו",checkmark:" ✓"},en:{itemsTab:"Items",itemsDesc:"Panels",arrowTab:"Arrow",settingsTab:"Settings",settingsDesc:"Size & behavior",panel:e=>`Panel ${e}`,panelDesc:"Reorder, set default state, or remove this panel. Edit its text directly on the canvas.",openDefault:"Open by default",openDefaultDesc:"Show this panel expanded when the page loads.",moveUp:"Move Up",moveUpDesc:"Move this panel one position up.",moveDown:"Move Down",moveDownDesc:"Move this panel one position down.",removePanel:"Remove Panel",removePanelDesc:"Delete this panel.",addPanel:"Add Panel",addPanelDesc:"Add a new panel to the accordion.",arrowIcon:"Arrow icon",arrowColor:"Arrow color",arrowSide:"Arrow side",arrowSideDesc:"Which side of the title the arrow sits on.",arrowAuto:"Auto (follow text direction)",arrowLeft:"Left",arrowRight:"Right",width:"Width",widthDesc:"Overall width of the accordion.",maxWidth:"Max Width",maxWidthDesc:"Maximum width of the accordion.",multipleOpen:"Multiple panels open",singleOpen:"One panel open at a time",allowMultipleDesc:"Toggle whether several panels can be expanded at once.",borderColor:"Border Color",panelBackground:"Panel background",panelBackgroundDesc:"Colors both the header and the content of this panel.",globalBackground:"Background for all panels",globalBackgroundDesc:"The default for panels with no color of their own.",clearBackground:"Remove background",clearBackgroundDesc:"Back to a transparent panel.",designTab:"Design",designDesc:"Font, sizes, colors & arrow",fontFamily:"Font",fontFamilyDesc:"Applies to every panel in the accordion.",headings:"Headings",headingSize:"Heading size",contentHeading:"Content",contentSize:"Text size",textColor:"Text color",textColorDesc:"Applies to every panel in the accordion.",globalTypographyNote:"Changing these restyles every panel and replaces formatting set on individual words.",spacing:"Spacing",gap:"Gap between panels",paddingX:"Horizontal padding",paddingY:"Vertical padding",dividerHeading:"Divider",showDivider:"Show divider",hideDivider:"Hide divider",showDividerDesc:"The line separating the panels.",dividerWidth:"Divider thickness",dividerStyle:"Divider style",checkmark:" ✓"}};let y=null;function f(e){let{component:t,commands:o}=e;const a=function(){try{return"en"!==n.M.get("config","language")}catch(e){return!1}}()?m.he:m.en,i=Array.isArray(t.props.items)?t.props.items:[],c=t.props.style||{},l=t.accordion||{},d=!1!==t.props.allowMultiple,p=!1!==t.props.showDivider,u=(e,o)=>{const n=function(e,t){const o=s(e,t);return o.header&&o.header.backgroundColor||o.content&&o.content.backgroundColor||""}(t.props,e);return[{type:"colorpicker",title:a.panelBackground,description:a.panelBackgroundDesc,alpha:!1,value:n||"#ffffff",onChange:e=>l.setPanelBackground&&l.setPanelBackground(o,e.target.value)},{type:"option",text:a.clearBackground,description:a.clearBackgroundDesc,active:!!n,onClick:()=>l.setPanelBackground&&l.setPanelBackground(o,"")}]},f=i.map((e,t)=>({type:"accordion",label:a.panel(t+1),isOpen:!1,description:a.panelDesc,onToggle:()=>{},children:[{type:"option",text:e.isOpen?a.openDefault+a.checkmark:a.openDefault,description:a.openDefaultDesc,active:!0,onClick:()=>l.setDefaultOpen&&l.setDefaultOpen(t,!e.isOpen)},{type:"option",text:a.moveUp,description:a.moveUpDesc,active:t>0,onClick:()=>l.moveItem&&l.moveItem(t,t-1)},{type:"option",text:a.moveDown,description:a.moveDownDesc,active:t<i.length-1,onClick:()=>l.moveItem&&l.moveItem(t,t+1)},{type:"divider"},...u(e,t),{type:"divider"},{type:"option",text:a.removePanel,icon:"remove",color:"red",description:a.removePanelDesc,onClick:()=>l.removeItem&&l.removeItem(t)},{type:"divider"}]})),v=()=>t.props.arrowSide||"auto",w=()=>[{value:"auto",label:a.arrowAuto},{value:"left",label:a.arrowLeft},{value:"right",label:a.arrowRight}],C=()=>{const e=v(),t=w().find(t=>t.value===e);return t?t.label:a.arrowAuto},x=(e,n,r)=>{const a=parseInt(e.target.value,10);var i;a&&a!==t.props[n]&&(o.execCommand(n,a),i=()=>r&&r(a),clearTimeout(y),y=setTimeout(i,200))},b=e=>x(e,"headingFontSize",l.setHeadingFontSize),D=e=>x(e,"contentFontSize",l.setContentFontSize);return{tabs:e=>{const t=[{text:a.itemsTab,description:a.itemsDesc},{text:a.designTab,description:a.designDesc},{text:a.settingsTab,description:a.settingsDesc}];return t.forEach(t=>{t.selected=t.text===e}),t},layout:e=>{let{tab:n}=e;return n.text===a.designTab?[{type:"info",text:a.globalTypographyNote},{type:"fontFamily",title:a.fontFamily,description:a.fontFamilyDesc,value:t.props.fontFamily||"Arial",onChange:e=>{o.execCommand("fontFamily",e.target.name||e.target.value),l.setFontFamily&&l.setFontFamily(e.target.value)}},{type:"divider"},{type:"heading",level:4,text:a.headings},{type:"slider",title:a.headingSize,unit:"px",min:8,max:72,value:t.props.headingFontSize||16,onInput:e=>b(e),onChange:e=>b(e)},{type:"divider"},{type:"heading",level:4,text:a.contentHeading},{type:"slider",title:a.contentSize,unit:"px",min:8,max:72,value:t.props.contentFontSize||14,onInput:e=>D(e),onChange:e=>D(e)},{type:"divider"},{type:"colorpicker",title:a.textColor,description:a.textColorDesc,alpha:!1,value:t.props.textColor||"#000000",onChange:e=>{o.execCommand("textColor",e.target.value),l.setTextColor&&l.setTextColor(e.target.value)}},{type:"divider"},{type:"heading",level:4,text:a.arrowTab},{type:"icons",title:a.arrowIcon,useIconsApi:!0,selectedIcon:h(t.props),iconColor:g(t.props.iconColor),iconSize:24,onChange:e=>{const n=e.detail;if(!n)return;null!=n.category&&null!=n.name&&(o.execCommand("iconCategory",n.category),o.execCommand("iconName",n.name));const r=(null!=n.color?n.color:t.props.iconColor||"000000").toString().replace(/^#/,"");o.execCommand("iconColor",r)}},{type:"colorpicker",title:a.arrowColor,alpha:!1,value:t.props.iconColor?t.props.iconColor.startsWith("#")?t.props.iconColor:"#"+t.props.iconColor:"#000000",onChange:e=>{o.execCommand("iconColor",(0,r.A)(e.target.value).toHex())}},{type:"dropdown",title:a.arrowSide,description:a.arrowSideDesc,value:C(),selected:v(),items:w(),onChange:e=>{let{target:t}=e;return o.execCommand("arrowSide",t.value)}}]:n.text===a.settingsTab?[{type:"input",title:a.width,description:a.widthDesc,value:c.width||"",onInput:e=>{let{target:t}=e;return o.execCommand("style",{width:t.value})}},{type:"input",title:a.maxWidth,description:a.maxWidthDesc,value:c.maxWidth||"",onInput:e=>{let{target:t}=e;return o.execCommand("style",{maxWidth:t.value})}},{type:"option",text:d?a.multipleOpen+a.checkmark:a.singleOpen,description:a.allowMultipleDesc,active:!0,onClick:()=>o.execCommand("allowMultiple",!d)},{type:"colorpicker",title:a.borderColor,alpha:!1,value:t.props.borderColor||"#e6e6e6",onChange:e=>o.execCommand("borderColor",e.target.value)},{type:"divider"},{type:"colorpicker",title:a.globalBackground,description:a.globalBackgroundDesc,alpha:!1,value:t.props.headerStyle&&t.props.headerStyle.backgroundColor||"#ffffff",onChange:e=>l.setGlobalBackground&&l.setGlobalBackground(e.target.value)},{type:"option",text:a.clearBackground,description:a.clearBackgroundDesc,active:!(!t.props.headerStyle||!t.props.headerStyle.backgroundColor),onClick:()=>l.setGlobalBackground&&l.setGlobalBackground("")},{type:"divider"},{type:"heading",level:4,text:a.spacing},{type:"slider",title:a.gap,unit:"px",min:0,max:60,value:parseInt(t.props.gap,10)||0,onInput:e=>{let{target:t}=e;return o.execCommand("gap",`${t.value}px`)}},{type:"slider",title:a.paddingX,unit:"px",min:0,max:60,value:parseInt(t.props.paddingX,10)||(i.some(e=>e.headerStyle&&e.headerStyle.backgroundColor||e.contentStyle&&e.contentStyle.backgroundColor||t.props.headerStyle&&t.props.headerStyle.backgroundColor)?16:4),onInput:e=>{let{target:t}=e;return o.execCommand("paddingX",`${t.value}px`)}},{type:"slider",title:a.paddingY,unit:"px",min:0,max:60,value:parseInt(t.props.paddingY,10)||14,onInput:e=>{let{target:t}=e;return o.execCommand("paddingY",`${t.value}px`)}},{type:"divider"},{type:"heading",level:4,text:a.dividerHeading},{type:"option",text:p?a.showDivider+a.checkmark:a.hideDivider,description:a.showDividerDesc,active:!0,onClick:()=>o.execCommand("showDivider",!p)},{type:"slider",title:a.dividerWidth,unit:"px",min:0,max:10,value:parseInt(t.props.dividerWidth,10)||1,onInput:e=>{let{target:t}=e;return o.execCommand("dividerWidth",`${t.value}px`)}},{type:"dropdown",title:a.dividerStyle,value:t.props.dividerStyle||"solid",selected:t.props.dividerStyle||"solid",items:[{value:"solid"},{value:"dashed"},{value:"dotted"},{value:"double"}],onChange:e=>{let{target:t}=e;return o.execCommand("dividerStyle",t.value)}}]:[...f,{type:"option",text:a.addPanel,icon:"add",description:a.addPanelDesc,onClick:()=>l.addItem&&l.addItem()}]}}}function v(e){let{helpers:t,controller:o}=e;return{set:(e,n,r)=>{switch(n){case"style":return e[n]=t.deepMerge(e[n]||{},r),o.applyStyle(),!0;case"items":return!!Array.isArray(r)&&(e[n]=r,o.reconcile(r),!0);case"headerStyle":case"contentStyle":case"itemStyle":case"gap":case"paddingX":case"paddingY":case"showDivider":case"dividerWidth":case"dividerStyle":case"arrowSide":return e[n]=r,o.applyItemStyles(),!0;case"fontFamily":case"headingFontSize":case"contentFontSize":case"textColor":case"allowMultiple":return e[n]=r,!0;case"borderColor":return e[n]=r,o.applyStyle(),!0;case"iconCategory":case"iconName":case"iconColor":return e[n]=r,o.refreshArrows(),!0;default:return!1}}}}var w=o(84488),C=o.n(w);const x="cdtr-accordion-styles",b=[];let D=!1,S=null;function k(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function A(e,t){if(!e)return;(e.__cdtrAppliedStyleKeys||[]).forEach(t=>e.style.removeProperty(t));const o=[];for(const n in t||{})Object.prototype.hasOwnProperty.call(t,n)&&(e.style.setProperty(k(n),t[n]),o.push(k(n)));e.__cdtrAppliedStyleKeys=o}function E(e){const t=e.iconCategory||"Arrows",o=e.iconName||"arrow-down-s-line",n=function(e){let t=(e||"000000").toString().trim();return t.startsWith("#")&&(t=t.slice(1)),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6!==t.length?"000000":t}(e.iconColor);return`${`https://img.creaditor.ai/icons/serve/${encodeURIComponent(t)}/${encodeURIComponent(o)}.png`}?${new URLSearchParams({width:"40",height:"40",color:n}).toString()}`}function F(e){const t=B();return{type:"doc",content:[{type:"paragraph",attrs:{lineHeight:"1.4",direction:t?"rtl":"ltr",textAlign:t?"right":"left"},content:e?[{type:"text",text:String(e)}]:[]}]}}function B(){try{return"en"!==n.M.get("config","language")}catch(e){return!1}}function O(e){if(!e||"string"!=typeof e)return;const t="$%^$%^";if(0===e.replace(/[^\P{L}a-z][^a-z]*/giu,t).indexOf(t))return!0;const o=e.replace(/[0-9]/g,"").replace(/\n/g,"");return/^[\u0590-\u05FF ,.,!,?,/,*,#,@,&,(,)'-]+$/i.test(o)}function I(e){let t="";const o=e=>{e&&("string"==typeof e.text&&(t+=e.text+" "),Array.isArray(e.content)&&e.content.forEach(o))};return e&&Array.isArray(e.content)&&e.content.forEach(o),t}const T={title:"label",content:"description"};function P(e,t){const o=e||{};return function(e){return e&&"object"==typeof e&&e.childNodes?{childNodes:e.childNodes}:{childNodes:F("string"==typeof e?e:"")}}(null!=o[t]?o[t]:o[T[t]])}function N(e){const t=e&&"object"==typeof e?{...e}:{};return delete t.label,delete t.description,{...t,title:P(e,"title"),content:P(e,"content"),isOpen:!(!e||!e.isOpen)}}const z=[8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,40,44,48,56,64,72];function M(e){return[{type:"fontFamily",fonts:e||[],useCloud:!0},{type:"fontSize",sizes:z},{type:"bold"},{type:"italic"},{type:"underline"},{type:"fontColor"},{type:"backcolor"},{type:"direction"},{type:"left"},{type:"center"},{type:"right"},{type:"clearFormat"}]}function $(e){return[{type:"fontFamily",fonts:e||[],useCloud:!0},{type:"fontSize",sizes:z},{type:"bold"},{type:"italic"},{type:"underline"},{type:"strike"},{type:"fontColor"},{type:"backcolor"},{type:"bullet"},{type:"numbered"},{type:"link"},{type:"unLink"},{type:"automation"},{type:"direction"},{type:"left"},{type:"center"},{type:"right"},{type:"clearFormat"}]}const H=()=>{const e="accordion";return{name:e,create:t=>{const{createElement:o,compose:r,helpers:a}=t,i=document.createElement("div");i.classList.add("cdtr-acc-root"),function(e){if(!e||!e.head||e.getElementById(x))return;const t=e.createElement("style");t.id=x,t.textContent='\n.cdtr-acc-root { display: block; }\n.cdtr-acc-item {\n border-bottom: var(--cdtr-acc-border-width, 1px)\n var(--cdtr-acc-border-style, solid) var(--cdtr-acc-border, #e6e6e6);\n}\n/* Adjacent-sibling so the gap never adds a stray margin above the first panel.\n A legacy per-item itemStyle.marginTop is inline and still overrides this. */\n.cdtr-acc-item + .cdtr-acc-item { margin-top: var(--cdtr-acc-gap, 0); }\n.cdtr-acc-header {\n display: flex; align-items: center; justify-content: space-between;\n gap: 12px; cursor: pointer;\n padding: var(--cdtr-acc-pad-y, 14px) var(--cdtr-acc-pad-x, 4px);\n}\n.cdtr-acc-title-host { flex: 1 1 auto; min-width: 0; font-weight: 600; }\n.cdtr-acc-arrow {\n flex: 0 0 auto; width: 20px; height: 20px; user-select: none;\n transition: transform .3s ease; pointer-events: none;\n}\n.cdtr-acc-item.is-open > .cdtr-acc-header .cdtr-acc-arrow { transform: rotate(180deg); }\n/* Order works along the flex main axis, which already follows the item\'s dir,\n so "start" is the left in LTR and the right in RTL. That is what lets one\n rule serve both an explicit side and either reading direction. */\n.cdtr-acc-item.cdtr-acc-arrow-start > .cdtr-acc-header .cdtr-acc-arrow { order: -1; }\n.cdtr-acc-panel {\n display: grid; grid-template-rows: 0fr;\n transition: grid-template-rows .3s ease;\n}\n.cdtr-acc-item.is-open > .cdtr-acc-panel { grid-template-rows: 1fr; }\n.cdtr-acc-panel-inner { overflow: hidden; min-height: 0; }\n.cdtr-acc-content-host {\n padding: 4px var(--cdtr-acc-pad-x, 4px) var(--cdtr-acc-pad-y, 14px);\n}\n',e.head.appendChild(t)}(i.ownerDocument||document);let l=n.M.get("config","target");"string"==typeof l&&(l=document.querySelector(l)),l||(l=document.body);const g=n.M.get("config","editor","configure","editorProps","fonts");let h=[],m=null,y=!1,w=!1,k=null;const F=()=>Array.isArray(r.props.items)?r.props.items:[],T=()=>F().map(e=>N(e)),z=()=>{const e=r.props.style||{};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i.style[t]=e[t]);r.props.borderColor&&i.style.setProperty("--cdtr-acc-border",r.props.borderColor)},H=()=>{const e=F();let t=!1;h.forEach((o,n)=>{const a=s(r.props,e[n]),i=function(e){return d(e.header)||d(e.content)||d(e.item)}(a);i&&(t=!0);const c=function(e){const t=O(I(P(e,"title").childNodes)),o=void 0===t?O(I(P(e,"content").childNodes)):t;return void 0===o?B()?"rtl":"ltr":o?"rtl":"ltr"}(e[n]);o.node.getAttribute("dir")!==c&&o.node.setAttribute("dir",c),o.node.classList.toggle("cdtr-acc-arrow-start",function(e,t){return"left"===e?"ltr"===t:"right"===e&&"rtl"===t}(r.props.arrowSide,c)),A(o.node,{...!0!==r.props.showDivider&&i?{borderBottom:"none"}:{},...a.item||{},direction:c}),A(o.header,a.header),A(o.contentHost,a.content)}),(e=>{const t=r.props,o=(e,t)=>{null==t||""===t?i.style.removeProperty(e):i.style.setProperty(e,t)};o("--cdtr-acc-gap",t.gap),o("--cdtr-acc-pad-y",t.paddingY),o("--cdtr-acc-pad-x",t.paddingX||(e?"16px":"")),o("--cdtr-acc-border-width",!1===t.showDivider?"0":t.dividerWidth),o("--cdtr-acc-border-style",t.dividerStyle)})(t)},W=function(e){let{structural:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};k&&(y=t,k.commands.execCommand("items",e),y=!1)},L=(e,t,o)=>{const n=P(F()[o],t).childNodes,r=C()({element:e,container:l||document.body,editable:!0,offsetTop:40,defaultDirection:B()?"rtl":"ltr",content:n,ignoresBlurByQuerySelectors:[".ignore-events"],builder:"title"===t?M(g):$(g),onFocus:()=>{if(!D||S===r||null===S){if(D=!0,S=r,m={index:o,field:t},b.length>0)for(b.forEach(e=>{e!==r&&e.hideEditor()});b.length>0;)b.pop();b.push(r),setTimeout(()=>{S===r&&D&&r.showEditor()},100)}},onBlur:()=>{m&&m.index===o&&m.field===t&&(m=null),S===r&&(S=null),setTimeout(()=>{S!==r&&(D=!1)},150)},onUpdate:e=>{let{editor:n,transaction:r}=e;if(0===r.steps.length||w)return;m={index:o,field:t};const a=T();a[o]&&(a[o][t]={childNodes:n.getJSON()},W(a))}});return r},R=e=>{const t=F()[e],o=document.createElement("div");o.className="cdtr-acc-item",t&&t.isOpen&&o.classList.add("is-open");const n=document.createElement("div");n.className="cdtr-acc-header";const a=document.createElement("div");a.className="cdtr-acc-title-host";const i=document.createElement("img");i.className="cdtr-acc-arrow",i.alt="",i.setAttribute("draggable","false"),i.src=E(r.props),n.append(a,i);const c=document.createElement("div");c.className="cdtr-acc-panel";const l=document.createElement("div");l.className="cdtr-acc-panel-inner";const d=document.createElement("div");return d.className="cdtr-acc-content-host",l.appendChild(d),c.appendChild(l),o.append(n,c),n.addEventListener("click",t=>{a.contains(t.target)||function(e){const t=!1!==r.props.allowMultiple,o=T();if(!o[e])return;const n=!o[e].isOpen;o.forEach((o,r)=>{o.isOpen=t?r===e?n:o.isOpen:r===e&&n}),h.forEach((e,t)=>{e.node&&e.node.classList.toggle("is-open",!!o[t].isOpen)}),W(o,{structural:!0})}(e)}),{itemNode:o,header:n,arrow:i,titleHost:a,panelInner:l,contentHost:d}},U=()=>{h.forEach(e=>{try{e.title&&e.title.hideEditor&&e.title.hideEditor(),e.content&&e.content.hideEditor&&e.content.hideEditor()}catch(e){}}),h=[]},j=()=>{U(),i.innerHTML="",F().forEach((e,t)=>{const{itemNode:o,header:n,arrow:r,titleHost:a,panelInner:c,contentHost:l}=R(t);i.appendChild(o);const d=L(a,"title",t);a.parentElement!==n&&n.insertBefore(a,r);const s=L(l,"content",t);l.parentElement!==c&&c.appendChild(l),h.push({title:d,content:s,node:o,header:n,contentHost:l})}),H()};const X=e=>t=>{const o=e&&e.ownerDocument||document,n=o.defaultView||window,r=o.createElement("span");r.style.cssText="display:none",r.style.color=t,(e||o.body).appendChild(r);const a=n.getComputedStyle(r).color;return r.remove(),a||""},Y=e=>{if(!e)return"";return((e.ownerDocument||document).defaultView||window).getComputedStyle(e).color||""},G=(e,t)=>{if(!h.length)return;w=!0;try{h.forEach(o=>{e.forEach(e=>{const n=o[e];if(n)try{n.chain().setMeta("addToHistory",!1).selectAll().setMark("textStyle",t).run()}catch(e){}})})}finally{w=!1}m=null;const o=T();h.forEach((t,n)=>{o[n]&&e.forEach(e=>{const r=t[e];r&&(o[n][e]={childNodes:r.getJSON()})})}),W(o,{structural:!0})},J=["title","content"],_={reconcile:e=>{!y&&Array.isArray(e)&&(e.length===h.length?(e.forEach((e,t)=>{["title","content"].forEach(o=>{const n=h[t]&&h[t][o],r=P(e,o).childNodes;if(n&&r&&(!m||m.index!==t||m.field!==o))try{JSON.stringify(n.getJSON())!==JSON.stringify(r)&&n.chain().setContent(r).run()}catch(e){}});const o=h[t]&&h[t].node;o&&o.classList.toggle("is-open",!!e.isOpen)}),H()):j())},applyStyle:z,refreshArrows:()=>{const e=E(r.props);h.forEach(t=>{const o=t.node&&t.node.querySelector(".cdtr-acc-arrow");o&&(o.src=e)})},applyItemStyles:H};return j(),z(),k=o({name:e,id:r.id,template:i,defaultProps:{style:{},items:[],allowMultiple:!0,iconCategory:"Arrows",iconName:"arrow-down-s-line",iconColor:"000000"},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>i,handleBar:!0,validator:v({helpers:a,controller:_}),schema:r.schema,onSelect:e=>i.classList.add(e),onDeselect:e=>i.classList.remove(e),elementProps:r,remove:()=>{U(),i.remove()},createEditor:f}),k.addProp("accordion",{addItem:()=>{const e=T(),t=e.length+1,o=B();e.push(N({title:o?`כותרת ${t}`:`Accordion title ${t}`,content:o?`תוכן הסעיף ${t}`:`Accordion content ${t}`})),W(e,{structural:!0}),j()},removeItem:e=>{const t=T();e<0||e>=t.length||(t.splice(e,1),W(t,{structural:!0}),j())},moveItem:(e,t)=>{const o=T();if(t<0||t>=o.length||e<0||e>=o.length)return;const[n]=o.splice(e,1);o.splice(t,0,n),W(o,{structural:!0}),j()},setDefaultOpen:(e,t)=>{const o=T();o[e]&&(o[e].isOpen=!!t,t&&!1===r.props.allowMultiple&&o.forEach((t,o)=>{o!==e&&(t.isOpen=!1)}),h.forEach((e,t)=>{e.node&&e.node.classList.toggle("is-open",!!o[t].isOpen)}),W(o,{structural:!0}))},setPanelBackground:(e,t)=>{const o=T();if(!o[e])return;const n=h[e]&&h[e].node||i;o[e]=p(o[e],t,u(t,Y(n),X(n))),W(o,{structural:!0}),H()},setGlobalBackground:e=>{if(!k)return;const t=p(r.props,e,u(e,Y(i),X(i)));[...c,"itemStyle"].forEach(e=>{k.commands.execCommand(e,t[e]||{})}),H()},setFontFamily:e=>G(J,{fontFamily:e}),setHeadingFontSize:e=>G(["title"],{fontSize:`${e}px`}),setContentFontSize:e=>G(["content"],{fontSize:`${e}px`}),setTextColor:e=>G(J,{color:e})}),k}}}}}]);
|
|
Binary file
|