Skip to content

Commit

Permalink
Merge by themes
Browse files Browse the repository at this point in the history
  • Loading branch information
hatappo committed Nov 19, 2021
1 parent 694cdee commit dc469c0
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 5 deletions.
9 changes: 5 additions & 4 deletions dist/zola-shortcodes-netlify-cms.DeepThought.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,11 @@ CMS.registerEditorComponent({
},
toBlock: function(obj) {
const id = obj.id || '';
return `{{ vimeo(id="${obj.id || ''}") }}`;
return `{{ vimeo(id="${id}") }}`;
},
toPreview: function(obj) {
const id = obj.id || '';
return `{{ vimeo(id="${obj.id || ''}") }}`;
return `{{ vimeo(id="${id}") }}`;
},
});
CMS.registerEditorComponent({
Expand All @@ -304,9 +304,10 @@ CMS.registerEditorComponent({
},
toBlock: function(obj) {
const id = obj.id || '';
return `{{ youtube(id="${obj.id || ''}") }}`;
return `{{ youtube(id="${id}") }}`;
},
toPreview: function(obj) {
return `<img src="http://img.youtube.com/vi/${obj.id}/mqdefault.jpg" alt="Youtube Video"/>`;
const id = obj.id || '';
return `<img src="http://img.youtube.com/vi/${id}/mqdefault.jpg" alt="Youtube Video"/>`;
},
});
3 changes: 2 additions & 1 deletion dist/zola-shortcodes-netlify-cms.built-in.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ CMS.registerEditorComponent({
return `{{ youtube(id="${id}"${p}${a}${c}) }}`;
},
toPreview: function(obj) {
return `<img src="http://img.youtube.com/vi/${obj.id}/mqdefault.jpg" alt="Youtube Video"/>`;
const id = obj.id || '';
return `<img src="http://img.youtube.com/vi/${id}/mqdefault.jpg" alt="Youtube Video"/>`;
},
});
186 changes: 186 additions & 0 deletions dist/zola-shortcodes-netlify-cms.juice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
CMS.registerEditorComponent({
id: "gist",
label: "Gist",
fields: [
{
name: "username",
label: "Github Username (mandatory)",
widget: "string"
},
{
name: "gid",
label: "Gist ID (mandatory)",
widget: "string"
},
{
name: "file",
label: "by default, the shortcode will pull every file from the URL unless a specific filename is requested (optional)",
widget: "string"
},
{
name: "class",
label: "a class to add to the <div> surrounding the iframe (optional)",
widget: "string"
},
],
pattern: /{{ gist\(url="https:\/\/gist\.github\.com\/([-a-zA-Z0-9]+)\/([a-zA-Z0-9]+)"(, file="([-_.a-zA-Z0-9]+)")?(, class="([a-zA-Z][-_.:a-zA-Z0-9 ]*)")?\) }}/,
fromBlock: function(match) {
return {
username: match[1],
gid: match[2],
file: match[4],
class: match[6],
};
},
toBlock: function(obj) {
const gid = obj.gid || '';
const username = obj.username || '';
const f = !!obj.file ? `, file="${obj.file}"` : '';
const c = !!obj.class ? `, class="${obj.class}"` : '';
return `{{ gist(url="https://gist.github.com/${username}/${gid}"${f}${c}) }}`;
},
toPreview: function(obj) {
const gid = obj.gid || '';
const username = obj.username || '';
const f = !!obj.file ? `, file="${obj.file}"` : '';
const c = !!obj.class ? `, class="${obj.class}"` : '';
return `{{ gist(url="https://gist.github.com/${username}/${gid}"${f}${c}) }}`;
},
});
CMS.registerEditorComponent({
id: "issue",
label: "GitHub Issue",
fields: [
{
name: "id",
label: "the issue id (mandatory)",
widget: "number"
},
],
pattern: /{{ issue\(id=([1-9][0-9]*)\) }}/,
fromBlock: function(match) {
return {
id: match[1],
};
},
toBlock: function(obj) {
const id = obj.id || '';
return `{{ issue(id=${id}) }}`;
},
toPreview: function(obj) {
const id = obj.id || '';
return `<a href="">Github Issue #${id}</a>`;
},
});
CMS.registerEditorComponent({
id: "streamable",
label: "Streamable",
fields: [
{
name: "id",
label: "the video id (mandatory)",
widget: "string"
},
{
name: "class",
label: "a class to add to the <div> surrounding the iframe (optional)",
widget: "string"
},
],
pattern: /{{ streamable\(id="([a-zA-Z0-9]+)"(, class="([a-zA-Z][-_.:a-zA-Z0-9 ]*)")?\) }}/,
fromBlock: function(match) {
return {
id: match[1],
class: match[3],
};
},
toBlock: function(obj) {
const id = obj.id || '';
const c = !!obj.class ? `, class="${obj.class}"` : '';
return `{{ streamable(id="${id}"${c}) }}`;
},
toPreview: function(obj) {
const id = obj.id || '';
const c = !!obj.class ? `, class="${obj.class}"` : '';
return `{{ streamable(id="${id}"${c}) }}`;
},
});
CMS.registerEditorComponent({
id: "vimeo",
label: "Vimeo",
fields: [
{
name: "id",
label: "the video id (mandatory)",
widget: "string"
},
{
name: "class",
label: "a class to add to the <div> surrounding the iframe (optional)",
widget: "string"
},
],
pattern: /{{ vimeo\(id="([0-9]+)"(, class="([a-zA-Z][-_.:a-zA-Z0-9 ]*)")?\) }}/,
fromBlock: function(match) {
return {
id: match[1],
class: match[3],
};
},
toBlock: function(obj) {
const id = obj.id || '';
const c = !!obj.class ? `, class="${obj.class}"` : '';
return `{{ vimeo(id="${id}"${c}) }}`;
},
toPreview: function(obj) {
const id = obj.id || '';
const c = !!obj.class ? `, class="${obj.class}"` : '';
return `{{ vimeo(id="${id}"${c}) }}`;
},
});
CMS.registerEditorComponent({
id: "youtube",
label: "YouTube",
fields: [
{
name: "id",
label: "the video id (mandatory)",
widget: "string"
},
{
name: "playlist",
label: "the playlist id (optional)",
widget: "string"
},
{
name: "autoplay",
label: "when set to \"true\", the video autoplays on load (optional)",
widget: "boolean"
},
{
name: "class",
label: "a class to add to the <div> surrounding the iframe (optional)",
widget: "string"
},
],
pattern: /{{ youtube\(id="([-a-zA-Z0-9]+)"(, playlist="([a-zA-Z0-9]+)")?(, autoplay=(true|false))?(, class="([a-zA-Z][-_.:a-zA-Z0-9 ]*)")?\) }}/,
fromBlock: function(match) {
return {
id: match[1],
playlist: match[3],
autoplay: match[5],
class: match[7],
};
},
toBlock: function(obj) {
const id = obj.id || '';
const p = !!obj.playlist ? `, playlist="${obj.playlist}"` : '';
const a = !!obj.autoplay ? `, autoplay=${obj.autoplay}` : '';
const c = !!obj.class ? `, class="${obj.class}"` : '';
return `{{ youtube(id="${id}"${p}${a}${c}) }}`;
},
toPreview: function(obj) {
const id = obj.id || '';
return `<img src="http://img.youtube.com/vi/${id}/mqdefault.jpg" alt="Youtube Video"/>`;
},
});

0 comments on commit dc469c0

Please sign in to comment.