@silexlabs/silex-cms
Advanced tools
Comparing version 0.0.81 to 0.0.82
{ | ||
"name": "@silexlabs/silex-cms", | ||
"version": "0.0.81", | ||
"version": "0.0.82", | ||
"description": "Silex plugin", | ||
@@ -5,0 +5,0 @@ "main": "dist/server.js", |
@@ -27,2 +27,6 @@ import { ClientConfig } from '@silexlabs/silex/src/ts/client/config' | ||
placeholder: 'param1, "example param 2"', | ||
}, { | ||
type: 'checkbox', | ||
label: 'Is paired', | ||
name: 'shortcode_is_paired', | ||
}], | ||
@@ -33,4 +37,18 @@ }, | ||
function updateShortcode(component) { | ||
const { shortcode_attributes, shortcode_name } = component.get('attributes') | ||
component.components(`{% ${shortcode_name} ${shortcode_attributes ?? ''} %}`) | ||
const { shortcode_attributes, shortcode_name, shortcode_is_paired } = component.get('attributes') | ||
const componentsToKeep = component.components() | ||
.filter(c => c.view?.el?.nodeType === 1) | ||
component.components(shortcode_is_paired ? ` | ||
{% ${shortcode_name} ${shortcode_attributes ?? ''} %} | ||
<div class="replace_content"></div> | ||
{% end${shortcode_name} %} | ||
` : ` | ||
{% ${shortcode_name} ${shortcode_attributes ?? ''} %} | ||
`) | ||
const replaceContentDiv = component.components().find(c => c.getClasses().includes('replace_content')) | ||
if (!replaceContentDiv) { | ||
console.error('No replace_content found', { component, componentsToKeep }) | ||
return | ||
} | ||
replaceContentDiv.replaceWith(componentsToKeep) | ||
} | ||
@@ -60,8 +78,8 @@ editor.TraitManager.addType('shortcode-name', { | ||
droppable: true, | ||
// Prevent the drop down from opening on click | ||
script: function() { | ||
this.addEventListener('mousedown', event => { | ||
event.preventDefault() | ||
}) | ||
}, | ||
// // Prevent the drop down from opening on click | ||
// script: function() { | ||
// this.addEventListener('mousedown', event => { | ||
// event.preventDefault() | ||
// }) | ||
// }, | ||
}, | ||
@@ -68,0 +86,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2630132
18166