I am using Joomla for my websites and I have added SlideShowPro to multiple websites with success.
However for some reason when I add the extension to one of my particular sites, something is going wrong.
I'm using JCE and under Editor Parameters > Advanced, I have all of the following turned on:
Allow Javascript
Allow CSS
Allow PHP XHTML Inline Scripts
Under the tab Plugin Parameters then Media Support, I have all of the following turned off:
Strict XHTML Flash
Allow HTML5 Audio
Allow HTML5 Video
Allow OBJECT Elements
Allow EMBED Elements
and Allow Iframes
When I add the following code:
<!-- START EMBED CODE -->
<script type="text/javascript" src="http://www.colmandesigns.co.nz/colmangallery/m/embed.js"></script>
<div id="album-6">
</div>
<script type="text/javascript">
SlideShowPro({
attributes: {
id: "album-6",
width: 550,
height: 400
},
mobile: {
auto: false
},
params: {
bgcolor: "#000000",
allowfullscreen: true
},
flashvars: {
xmlFilePath: "http://www.colmandesigns.co.nz/colmangallery/images.php?album=6",
paramXMLPath: "http://www.colmandesigns.co.nz/colmangallery/m/params/chrome.xml",
contentScale: "Crop to Fit All"
}
});
</script>
<!-- END EMBED CODE -->
It ends up coming out like this once I click save:
<!-- START EMBED CODE -->
<p>
<s-cript type="text/j-avascript" src="http://www.colmandesigns.co.nz/colmangallery/m/embed.js"></s-cript>
</p>
<div id="album-6"> </div>
<p>
<s-cript type="text/j-avascript"> SlideShowPro({ attributes: { id: "album-6", width: 550, height: 400 }, mobile: { auto: false }, params: { bgcolor: "#000000", allowfullscreen: true }, flashvars: { xmlFilePath: "http://www.colmandesigns.co.nz/colmangallery/images.php?album=6", paramXMLPath: "http://www.colmandesigns.co.nz/colmangallery/m/params/chrome.xml", contentScale: "Crop to Fit All" } });
<!-- END EMBED CODE -->
</s-cript>
</p>
<p> </p>
What do I need to do differently?
Yes, WYSIWYG editors will mess your embedded scripts and styles. What I do on my sites is configure JCE to not appear by default.
Go to "Components > JCE Editor > Profiles > Default > Features and Layout > Editor State" and set it to "Off".
This will give you a generic text area for editing your articles (by default) and a link to turn on WYSIWYG editing. This way it will not mess up your JavaScript / CSS.
You can also try "Flexi Custom Code" module, which works similarly to "Custom HTML" module but is intended to be used for JS / CSS instead.
Good luck.
Disabling text filters for super users might help:
Go do administrator / global config / text filters and choose no filters next to Super Users
Related
I'm trying to create a simple gallery component where if you click on some image a Light-Box will appear where you can see full size photo and have options like next and previous photo or close the Light-Box.
Currently When I need to change the image to next or previous I change the src of the img-tag and it works.
Here comes my problem. I want to lazy load my images. I use lazysizes in my project.
So the simple implementation to have an image to load is to add the class "lazyload" and to pass the property data-src instead of src.
However if I change to data-src my methods for next and previous image are not working.
< script >
export default {
props: {
data: {
type: Array,
required: true,
},
},
data: () => ({
visible: false,
currentImage: 0,
}),
methods: {
Toggle(index) {
this.currentImage = index
this.visible = !this.visible
},
Next() {
if (this.currentImage !== this.data.length - 1) this.currentImage++
},
Prev() {
if (this.currentImage !== 0) this.currentImage--
},
},
} <
/script>
<template>
<div id="gallery" class="gallery">
<!-- images grid -->
<div v-for="(item, i) in data" :key="'gallery-image' + i" class="image">
<img :src="item.image.thumbnail.url" #click.native="Toggle(i)" class="lazyload"/>
</div>
<!-- image lighbox on click -->
<div v-if="visible" class="lightbox">
<Icon class="cancel" #click="Toggle()"/>
<Icon name="left" :class="{ disable: currentImage == 0 }" #click="Prev()"/>
<img :src="data[currentImage].image.url" class="lazyload"/>
<Icon name="right" :class="{ disable: currentImage == data.length - 1 }" #click="Next()"/>
</div>
</div>
</template>
UPDATE
I forgot to add crucial code. To implement lazysizes in a Nuxt project we need to add in nuxt.config.js the fallowing code. You can read more here.
build: {
extend(config, { isClient, loaders: { vue } }) {
vue.transformAssetUrls.img = ['data-src', 'src']
},
},
As I investigate in the developer tools I found that when triggering click for method like Next image, the src of the image does not change, only the data-src. I'm guessing I need a way to trigger this transform so that everything can work as expected.
Also, on top of my comment, I do recommend looking into the official nuxt image module which do have native lazy loading out of the box: https://image.nuxtjs.org/components/nuxt-img
You could maybe combo this with some simple lightbox that does the trick for you. I've used vue-silentbox before, it is working pretty well.
You can have that kind of code there
<silent-box :gallery="photosToDisplay">
<template #silentbox-item="{ silentboxItem }">
<img :src="silentboxItem.src" :key="silentboxItem.id" />
</template>
</silent-box>
So, I guess that you could totally swap img by a nuxt-img there, and have it lazy-loaded.
The images are not lazy-loaded in the project, but here is a small project that I did to try out the lightbox if you want to quickly look how it renders (URL in the top right corner).
Probably this is not the most elegant way to do it . I force re-render to my image component. You need to assign a key value to component and whenever the value changes a new instance creates of the component.
I am using the shared spaces plugin with Ckeditor to load a shared toolbar for multiple ckeditors but it still loads individual toolbar for all editors.
Here is a fiddle with the code that I am using: https://jsfiddle.net/7Lrcup3L/
HTML:
<div id="topSpace"></div>
<textarea id="editor1" name="editor1"></textarea>
<textarea id="editor2" name="editor2"></textarea>
<div id="bottomSpace"></div>
JS:
CKEDITOR.replace('editor1',{
sharedSpaces: {
top: 'topSpace',
bottom: 'bottomSpace'
}
})
CKEDITOR.replace('editor2',{
sharedSpaces: {
top: 'topSpace',
bottom: 'bottomSpace'
}
})
Need help with the same!
Shared Space is an optional plugin that is not included in the Standard preset. You should add it to your build first and/or enable with config.extraPlugins.
Check the source code of the Shared Toolbar and Bottom Bar SDK sample - just scroll down to the "Get Sample Source Code" to see a working sample for classic and inline editors.
I have a editor template for my kendo grid defined as
<script id="my-editor-template" type="text/x-kendo-template">
<div class="k-edit-label">
<label for="ContactName">Contact</label>
</div>
<div data-container-for="ContactName" class="k-edit-field">
<input type="text" class="k-input k-textbox" name="ContactName" data-bind="value:ContactName">
</div>
<!-- more fields, etc -->
</script>
In my grid definition, I definte editable like this:
editable =
{
mode: 'popup',
template: kendo.template($('#my-editor-template').html()),
confirmation: 'Are you sure you want to delete rec'
};
But I would like to make the popup window wider. I tried wrapping the contents of my template in a
<div style="width: 800px;"></div>
but the popup window stayed the same with, and made the contents scrollable (i.e., 800px content inside a 400px window).
I know I can do a
$(".k-edit-form-container").parent().width(800).data("kendoWindow").center();
after the window is opened, but all the content of the window is formatted for like 400px, and it feels a little hackish. Is there not a way I can dictate teh size in the template markup?
Kendo grid popup window is using kendo window, so you can set the height and width like this
editable: {
mode: "popup",
window: {
title: "My Custom Title",
animation: false,
width: "600px",
height: "300px",
}
}
Here is dojo for you, but since i did not define a custom template it still use default one so as the result the window size already 600 x 300 but the content is not.
After an hour+ long research following code fixed my issue. I had to put this code in the edit event.
$(".k-edit-form-container").attr('style', "width:auto");
I have configured a no toolbar and ReadOnly instance of CKEditor to show formatted HTML on a web page.
This was working well with V3.5 of CKEditor with:
<script language="javascript" type="text/javascript">
$('.CKEditorRTE').ckeditor(function () { }, { readOnly: true, toolbar: 'ReadOnly',toolbarStartupExpanded: false, toolbarCanCollapse: false, toolbar_Custom: [],uiColor: '#edeff1', resize_minHeight : 100, height: 125, resize_minWidth : 100, width: 600 })
</script>
With V4.4.5 The formatting goes, unless I put the following in the "Config.js"
config.toolbar_ReadOnly = [{items: ['Format']}];
Now I actually do not want this format icon, but I do want the preformatted text. So how can I have preformatted HTML text with no toolbar icons with CKEditor 4.4.5 ?
I have a rather large ASP.NET MVC web application which uses KnockoutJS extensively throughout. Over the years I've created many templates for the application, however they all reside in various web pages using named script tags. It's almost become unbearable to manage them on the various views. I'd like to figure out a way to consolidate these templates into their own html files so that they are more manageable.
I'd like to know if there are any libraries out there that supports this concept? I don't want to reinvent the wheel, as I'm sure someone has already ran into this problem in the past and solved it. Here is a quick overview of what I'm dealing with...
Basically, I have a lot of content that resembles the following markup. Notice that I have my templates defined in the same page as my actual content markup:
[[ HOME/INDEX.CSHTML ]]
<h1>Customers</h1>
<div data-bind="template: {name: 'personTmpl', foreach: customers}"></div>
<h1>Products</h1>
<div data-bind="template: {name: 'productTmpl', foreach: products}"></div>
<script type="text/html" id="personTmpl">
Name: <span data-bind="text: name" />
Address: <span data-bind="text: address" />
</script>
<script type="text/html" id="productTmpl">
Description: <span data-bind="text: description" />
Category: <span data-bind="text: category" />
</script>
<script type="text/javascript">
$(function(){
var json = {
customers: [ { name: 'Joe', address: 'Denver, CO' } ],
products: [ { name: 'Skis', category: 'Outdoors' } ]
};
var vm = new CustomViewModel(json);
ko.applyBindings(vm);
});
</script>
[[ END HOME/INDEX.CSHTML ]]
What I'd like to do is store the personTmpl and productTmpl in their own html file and pull them into the view as needed. This would allow me to only have the content markup in my cshtml file. Plus it would enable me to use the templates from anywhere (ie. Customers\Index, Products\Show, Home\Index, etc..).
I would expect that it would require some custom js on each page, but I think this is a small price to pay for cleaning up the clutter and making my templates available to all views. I could see me using some server side tags on each page or something like this (merely an example):
#section templates {
#Content.Template("Person.tmpl", Url)
#Content.Template("Product.tmpl", Url)
}
<h1>Customers</h1>
<div data-bind="template: {name: 'personTmpl', foreach: customers}"></div>
<h1>Products</h1>
<div data-bind="template: {name: 'productTmpl', foreach: products}"></div>
<script type="text/javascript">
$(function(){
var json = #Html.Raw(Json.Encode(ViewBag.PageData)));
var vm = new CustomViewModel(json);
ko.applyBindings(vm);
});
</script>
With storing them into their own templates, I could even query the content dynamically for tooltips and dialogs using old fashion $.get('/tmpl/Person.tmpl', renderFunc).
Again, I don't mind creating my own implementation, but I'm convinced there is a solution out there already. Anybody?
Thanks in advance!!
My recommendation would be to look at the external template engine here: https://github.com/ifandelse/Knockout.js-External-Template-Engine
It allows you to place your templates in external files, reference them in your binding just as you normally would using the name parameter, and uses some conventions or configuration to determine the exact path to find the template file.
The external template engine is a pretty robust solution. I have also recently been using require.js with its text plugin for this purpose as well. More info in this answer: knockout.js loading templates at runtime
If you want to render them in-line, then I suppose a helper function could load the file and wrap it in a script tag with a non-JS type.