diff --git a/README.md b/README.md index ac3154c..c4a5307 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,18 @@ Gramateria v1.0.6 is a re-rewritten version that changed many features and code. - Added new blocks - Add Notyf for toast messages - Remove Gapesjs export plugin +- Remove dashboard version in v1.0.4 which was built with vue.js, element UI and firebase. [reason of removing dashboard](#remove-message) +#### Reason of removing dashboard + +Because making Gramateria to compatible with Vue, ElementUI and Firebase versions is not an easy task for me. And I want to keep Gramateria as a desktop based app. + +#### Roadmap +- Add more blocks +- Make it available for linux and window. +- Add more SEO tags +- Build multiple pages ### Credits - Grapesjs [Grapes JS](https://www.grapesjs.com/ "Grapes Js") - Bootstrap 5 [Bootstrap 5](https://www.getbootstrap.com/ "Bootstrap 5") diff --git a/gramateria/develop/js/config/customScripts.js b/gramateria/develop/js/config/customScripts.js index 35d3299..7b570c0 100644 --- a/gramateria/develop/js/config/customScripts.js +++ b/gramateria/develop/js/config/customScripts.js @@ -3,20 +3,40 @@ export default (dependency) => { let scriptArr = [ { name: 'splidejs', - script: `new Splide('#splide', { - type : 'loop', - perPage: 3, - focus : 'center', - pagination: false, - breakpoints: { - 768: { - perPage: 2, - }, - 576:{ - perPage:1 - } - } - }).mount();` + script: `(()=>{ + new Splide('#splide', { + type : 'loop', + perPage: 3, + focus : 'center', + pagination: false, + breakpoints: { + 768: { + perPage: 2, + }, + 576:{ + perPage:1 + } + } + }).mount(); + })();` + }, + { + name: 'contactjs', + script:`(()=>{ + const contactForm = document.querySelector("#contactForm"); + if(!contactForm) return; + contactForm.addEventListener('submit', function (e) { + const isPassed = document.querySelector("#contactForm").checkValidity(); + e.preventDefault(); + if (!isPassed) { + e.preventDefault() + e.stopPropagation() + } + + contactForm.classList.add('was-validated') + }, false) + })(); + ` } ] diff --git a/gramateria/develop/js/config/sectionBlocks.js b/gramateria/develop/js/config/sectionBlocks.js index 7ebf079..744a819 100644 --- a/gramateria/develop/js/config/sectionBlocks.js +++ b/gramateria/develop/js/config/sectionBlocks.js @@ -227,7 +227,7 @@ export default [ label: 'Testimonial', category: 'Sections', attributes: { - class: 'fa fa-th' + class: 'fa fa-sitemap' }, content: `
@@ -313,28 +313,230 @@ export default [
- Google

Google

+

Google

Google
- Nike

Nike

+

Nike

Nike
- Apple

Apple

+

Apple

Apple
- IBM

IBM

+

IBM

IBM
- Uber

Uber

+

Uber

Uber
- Window

Window

+

Window

Window
` + }, + { + id:'section-contact', + label:'Contact', + category:'Sections', + attributes:{ + class:'fa fa-envelope' + }, + content:`
+
+
+
+
+

We love to hear from you

+
+

HUTCHINSON

+

4663 Sunny Day Drive

+

714-778-6685

+
+
+
+
+
+
+
+ + +
Name is required
+
+
+ +
Email is required
+
+ +
+
+ +
Message is required
+
+ +
+
+
+
+
+
+
` + }, + { + id:'section-parallax', + label:'Parallax', + category:'Sections', + attributes:{ + class:"fa fa-copy" + }, + content:`
+
+
+
+
+ + +

Title text

+

Lorem ipsum, dolor sit amet consectetur adipisicing elit. Vitae repellendus maiores enim dolore nesciunt!

+
+
+
+
+
` + }, + { + id:'section-team', + label:'Team', + category:'Sections', + attributes:{ + class:'fa fa-th' + }, + content:`
+
+
+

OUR AMAZING TEAM

+
+
+
+
+ +
+
+
+ +
+
+

Peter J. Lamy

+

Software Developer

+

Lorem ipsum dolor sit amet, consectetur adipiscing tristique hendrerit laoreet.

+ +
+
+
+ +
+
+ +
+
+
+ +
+
+

June D. Smith

+

Product Manager

+

Lorem ipsum dolor sit amet, consectetur adipiscing tristique hendrerit laoreet.

+ +
+
+
+ +
+
+ +
+
+
+ +
+
+

Dianna C. Avila

+

Graphic Designer

+

Lorem ipsum dolor sit amet, consectetur adipiscing tristique hendrerit laoreet.

+ +
+
+
+ +
+
+ +
+
+
+ +
+
+

Robert C. Young

+

Web Designer

+

Lorem ipsum dolor sit amet, consectetur adipiscing tristique hendrerit laoreet.

+ +
+
+
+ +
+
` }, { id: 'section-footer', diff --git a/gramateria/develop/js/gramateria.js b/gramateria/develop/js/gramateria.js index 51d54b5..1a6863d 100755 --- a/gramateria/develop/js/gramateria.js +++ b/gramateria/develop/js/gramateria.js @@ -13,6 +13,18 @@ let sectionDependencies = [ { name:'testimonial', dependencies:['splidejs'] + }, + { + name:'contact', + dependencies:['contactjs'] + } +] + +const dependencyScripts = [ + { + name:'splidejs', + css:'https://cdn.jsdelivr.net/npm/@splidejs/splide@latest/dist/css/splide.min.css', + js:'https://cdn.jsdelivr.net/npm/@splidejs/splide@latest/dist/js/splide.min.js' } ] @@ -287,29 +299,33 @@ class Gramateria { return new Promise((resolve,reject)=>{ let dependencies = getLocal('gram-dependencies'); - let isExit = dependencies.filter(d=>d.name === dependency); + let isDependencyExit = dependencies.filter(d=>d.name === dependency); - if(isExit.length !== 0){ + if(isDependencyExit.length !== 0){ resolve(dependency); return; } - const link = document.createElement("link"); - link.rel = 'stylesheet'; - link.className = 'splidejs-script'; - link.href = 'https://cdn.jsdelivr.net/npm/@splidejs/splide@latest/dist/css/splide.min.css'; - doc.head.appendChild(link) - - const script = document.createElement("script"); - script.src = 'https://cdn.jsdelivr.net/npm/@splidejs/splide@latest/dist/js/splide.min.js'; - script.className = 'splidejs-script'; - doc.body.appendChild(script); + let ds = dependencyScripts.find(d => d.name === dependency ); + + if(!ds){ + resolve('done'); + return; + } + + const link = document.createElement("link"); + link.rel = 'stylesheet'; + link.className = ds.name+'-script'; + link.href = ds.css; + doc.head.appendChild(link) + + const script = document.createElement("script"); + script.src = ds.js; + script.className = ds.name+'-script'; + doc.body.appendChild(script); + + dependencies.push(ds) - dependencies.push({ - name:'splidejs', - js:script.src, - css:link.href - }) addLocal('gram-dependencies',dependencies) @@ -320,6 +336,15 @@ class Gramateria { appendDependency().then((dep)=>{ if(dep === dependency) return; + + + let cScripts = getLocal('gjs-scripts'); + let isCustomScriptExit = cScripts.filter(d=>d.name === dependency); + + if(isCustomScriptExit.length !== 0){ + return; + } + setTimeout(()=>{ const customScript = document.createElement("script"); customScript.innerHTML = customScripts(dependency); @@ -345,8 +370,19 @@ class Gramateria { } removeDependency (dependency){ - let doc = this.editor.Canvas.getDocument(); + + let customScript = getLocal('gjs-scripts'); + // Custom scripts + for(let custom of customScript){ + let allCustomScripts = doc.querySelectorAll(`.${custom.name}-script`); + allCustomScripts.forEach(e=>e.outerHTML = '') + } + customScript = customScript.filter(c=>c.name !== dependency); + addLocal('gjs-scripts',customScript); + + + // Dependencies / plugins let dependencies = getLocal('gram-dependencies'); if(dependencies.length == 0) return; @@ -357,10 +393,7 @@ class Gramateria { dependencies = dependencies.filter(d=>d.name !== dependency); addLocal('gram-dependencies',dependencies); - - let customScript = getLocal('gjs-scripts'); - customScript = customScript.filter(c=>c.name !== dependency); - addLocal('gjs-scripts',customScript); + } listenAddDependencies = () =>{ diff --git a/gramateria/dist/gram.min.js b/gramateria/dist/gram.min.js index 0bb9677..ab8e23c 100644 --- a/gramateria/dist/gram.min.js +++ b/gramateria/dist/gram.min.js @@ -646,7 +646,10 @@ __webpack_require__.r(__webpack_exports__); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (function (dependency) { var scriptArr = [{ name: 'splidejs', - script: "new Splide('#splide', {\n type : 'loop',\n perPage: 3,\n focus : 'center',\n pagination: false,\n breakpoints: {\n 768: {\n perPage: 2,\n },\n 576:{\n perPage:1\n }\n }\n }).mount();" + script: "(()=>{\n new Splide('#splide', {\n type : 'loop',\n perPage: 3,\n focus : 'center',\n pagination: false,\n breakpoints: {\n 768: {\n perPage: 2,\n },\n 576:{\n perPage:1\n }\n }\n }).mount();\n })();" + }, { + name: 'contactjs', + script: "(()=>{\n const contactForm = document.querySelector(\"#contactForm\");\n if(!contactForm) return;\n contactForm.addEventListener('submit', function (e) {\n const isPassed = document.querySelector(\"#contactForm\").checkValidity();\n e.preventDefault();\n if (!isPassed) {\n e.preventDefault()\n e.stopPropagation()\n }\n \n contactForm.classList.add('was-validated')\n }, false)\n })();\n " }]; var dep = scriptArr.filter(function (e) { return e.name === dependency; @@ -725,7 +728,7 @@ __webpack_require__.r(__webpack_exports__); label: 'Testimonial', category: 'Sections', attributes: { - "class": 'fa fa-th' + "class": 'fa fa-sitemap' }, content: "
\n
\n

Testimonials

\n
\n
\n \n
\n
\n
    \n
  • \n
    \n \"\"\n

    John Doe
    Backend developer

    \n
    \n

    Lorem ipsum dolor sit amet consectetur, adipisicing elit. Accusantium voluptates ut ad laudantium.

    \n
    \n \n
  • \n
  • \n
    \n \"\"\n

    Steve
    Co-founder of company

    \n
    \n

    Lorem ipsum dolor sit amet consectetur, adipisicing elit. Accusantium voluptates ut ad laudantium.

    \n
    \n \n
  • \n
  • \n
    \n \"\"\n

    Jessica
    Product Manager

    \n
    \n

    Lorem ipsum dolor sit amet consectetur, adipisicing elit. Accusantium voluptates ut ad laudantium.

    \n
    \n \n
  • \n
\n
\n
\n \n
\n
\n " }, { @@ -735,7 +738,31 @@ __webpack_require__.r(__webpack_exports__); attributes: { "class": 'fa fa-ellipsis-h' }, - content: "
\n
\n
\n
\n \"Google\"

Google

\n
\n
\n \"Nike\"

Nike

\n
\n
\n \"Apple\"

Apple

\n
\n
\n \"IBM\"

IBM

\n
\n
\n \"Uber\"

Uber

\n
\n
\n \"Window\"

Window

\n
\n
\n
\n
" + content: "
\n
\n
\n
\n

Google

\"Google\"\n
\n
\n

Nike

\"Nike\"\n
\n
\n

Apple

\"Apple\"\n
\n
\n

IBM

\"IBM\"\n
\n
\n

Uber

\"Uber\"\n
\n
\n

Window

\"Window\"\n
\n
\n
\n
" +}, { + id: 'section-contact', + label: 'Contact', + category: 'Sections', + attributes: { + "class": 'fa fa-envelope' + }, + content: "
\n
\n
\n
\n
\n

We love to hear from you

\n
\n

HUTCHINSON

\n

\t4663 Sunny Day Drive

\n

714-778-6685

\n
\n
\n
\n
\n
\n
\n
\n \n \n
Name is required
\n
\n
\n \n
Email is required
\n
\n \n
\n
\n \n
Message is required
\n
\n \n
\n
\n
\n
\n
\n
\n
" +}, { + id: 'section-parallax', + label: 'Parallax', + category: 'Sections', + attributes: { + "class": "fa fa-copy" + }, + content: "
\n
\n
\n
\n
\n \n \n

Title text

\n

Lorem ipsum, dolor sit amet consectetur adipisicing elit. Vitae repellendus maiores enim dolore nesciunt!

\n
\n
\n
\n
\n
" +}, { + id: 'section-team', + label: 'Team', + category: 'Sections', + attributes: { + "class": 'fa fa-th' + }, + content: "
\n
\n
\n

OUR AMAZING TEAM

\n
\n
\n
\n
\n \n
\n
\n
\n \"\"\n
\n
\n

Peter J. Lamy

\n

Software Developer

\n

Lorem ipsum dolor sit amet, consectetur adipiscing tristique hendrerit laoreet.

\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n \"\"\n
\n
\n

June D. Smith

\n

Product Manager

\n

Lorem ipsum dolor sit amet, consectetur adipiscing tristique hendrerit laoreet.

\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n \"\"\n
\n
\n

Dianna C. Avila

\n

Graphic Designer

\n

Lorem ipsum dolor sit amet, consectetur adipiscing tristique hendrerit laoreet.

\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n \"\"\n
\n
\n

Robert C. Young

\n

Web Designer

\n

Lorem ipsum dolor sit amet, consectetur adipiscing tristique hendrerit laoreet.

\n
\n \n
\n
\n
\n
\n \n
\n
" }, { id: 'section-footer', label: 'Footer', @@ -1191,6 +1218,14 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope var sectionDependencies = [{ name: 'testimonial', dependencies: ['splidejs'] +}, { + name: 'contact', + dependencies: ['contactjs'] +}]; +var dependencyScripts = [{ + name: 'splidejs', + css: 'https://cdn.jsdelivr.net/npm/@splidejs/splide@latest/dist/css/splide.min.css', + js: 'https://cdn.jsdelivr.net/npm/@splidejs/splide@latest/dist/js/splide.min.js' }]; var Gramateria = /*#__PURE__*/function () { @@ -1247,29 +1282,34 @@ var Gramateria = /*#__PURE__*/function () { var appendDependency = function appendDependency() { return new Promise(function (resolve, reject) { var dependencies = (0,_helpers_index__WEBPACK_IMPORTED_MODULE_3__.getLocal)('gram-dependencies'); - var isExit = dependencies.filter(function (d) { + var isDependencyExit = dependencies.filter(function (d) { return d.name === dependency; }); - if (isExit.length !== 0) { + if (isDependencyExit.length !== 0) { resolve(dependency); return; } + var ds = dependencyScripts.find(function (d) { + return d.name === dependency; + }); + + if (!ds) { + resolve('done'); + return; + } + var link = document.createElement("link"); link.rel = 'stylesheet'; - link.className = 'splidejs-script'; - link.href = 'https://cdn.jsdelivr.net/npm/@splidejs/splide@latest/dist/css/splide.min.css'; + link.className = ds.name + '-script'; + link.href = ds.css; doc.head.appendChild(link); var script = document.createElement("script"); - script.src = 'https://cdn.jsdelivr.net/npm/@splidejs/splide@latest/dist/js/splide.min.js'; - script.className = 'splidejs-script'; + script.src = ds.js; + script.className = ds.name + '-script'; doc.body.appendChild(script); - dependencies.push({ - name: 'splidejs', - js: script.src, - css: link.href - }); + dependencies.push(ds); (0,_helpers_index__WEBPACK_IMPORTED_MODULE_3__.addLocal)('gram-dependencies', dependencies); resolve('done'); }); @@ -1277,6 +1317,15 @@ var Gramateria = /*#__PURE__*/function () { appendDependency().then(function (dep) { if (dep === dependency) return; + var cScripts = (0,_helpers_index__WEBPACK_IMPORTED_MODULE_3__.getLocal)('gjs-scripts'); + var isCustomScriptExit = cScripts.filter(function (d) { + return d.name === dependency; + }); + + if (isCustomScriptExit.length !== 0) { + return; + } + setTimeout(function () { var customScript = document.createElement("script"); customScript.innerHTML = (0,_config_customScripts__WEBPACK_IMPORTED_MODULE_2__.default)(dependency); @@ -1589,17 +1638,16 @@ var Gramateria = /*#__PURE__*/function () { key: "removeDependency", value: function removeDependency(dependency) { var doc = this.editor.Canvas.getDocument(); - var dependencies = (0,_helpers_index__WEBPACK_IMPORTED_MODULE_3__.getLocal)('gram-dependencies'); - if (dependencies.length == 0) return; + var customScript = (0,_helpers_index__WEBPACK_IMPORTED_MODULE_3__.getLocal)('gjs-scripts'); // Custom scripts - var _iterator4 = _createForOfIteratorHelper(dependencies), + var _iterator4 = _createForOfIteratorHelper(customScript), _step4; try { for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { - var dp = _step4.value; - var allScripts = doc.querySelectorAll(".".concat(dp.name, "-script")); - allScripts.forEach(function (e) { + var custom = _step4.value; + var allCustomScripts = doc.querySelectorAll(".".concat(custom.name, "-script")); + allCustomScripts.forEach(function (e) { return e.outerHTML = ''; }); } @@ -1609,15 +1657,35 @@ var Gramateria = /*#__PURE__*/function () { _iterator4.f(); } + customScript = customScript.filter(function (c) { + return c.name !== dependency; + }); + (0,_helpers_index__WEBPACK_IMPORTED_MODULE_3__.addLocal)('gjs-scripts', customScript); // Dependencies / plugins + + var dependencies = (0,_helpers_index__WEBPACK_IMPORTED_MODULE_3__.getLocal)('gram-dependencies'); + if (dependencies.length == 0) return; + + var _iterator5 = _createForOfIteratorHelper(dependencies), + _step5; + + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { + var dp = _step5.value; + var allScripts = doc.querySelectorAll(".".concat(dp.name, "-script")); + allScripts.forEach(function (e) { + return e.outerHTML = ''; + }); + } + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); + } + dependencies = dependencies.filter(function (d) { return d.name !== dependency; }); (0,_helpers_index__WEBPACK_IMPORTED_MODULE_3__.addLocal)('gram-dependencies', dependencies); - var customScript = (0,_helpers_index__WEBPACK_IMPORTED_MODULE_3__.getLocal)('gjs-scripts'); - customScript = customScript.filter(function (c) { - return c.name !== dependency; - }); - (0,_helpers_index__WEBPACK_IMPORTED_MODULE_3__.addLocal)('gjs-scripts', customScript); } }, { key: "init", diff --git a/template-demo.html b/template-demo.html deleted file mode 100755 index 50bf72b..0000000 --- a/template-demo.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - Gramateria - - - - - - - - -
- - -
-
-
-

-

Parallax Template

-
-
A modern responsive front-end framework based on Material Design
-
- -

- -
-
-
Unsplashed background img 1
-
-
-
- - -
-
-
-

flash_on

-
Speeds up development
- -

We did most of the heavy lifting for you to provide a default stylings that incorporate our custom components. Additionally, we refined animations and transitions to provide a smoother experience for developers.

-
-
- -
-
-

group

-
User Experience Focused
- -

By utilizing elements and principles of Material Design, we were able to create a framework that incorporates components and animations that provide more feedback to users. Additionally, a single underlying responsive system across all platforms allow for a more unified user experience.

-
-
- -
-
-

settings

-
Easy to work with
- -

We have provided detailed documentation as well as specific code examples to help new users get started. We are also always open to feedback and can answer any questions a user may have about Materialize.

-
-
-
- -
-
-
-
-
-
-
A modern responsive front-end framework based on Material Design
-
-
-
-
Unsplashed background img 2
-
- -
-
- -
-
-

-

About Us

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam scelerisque id nunc nec volutpat. Etiam pellentesque tristique arcu, non consequat magna fermentum ac. Cras ut ultricies eros. Maecenas eros justo, ullamcorper a sapien id, viverra ultrices eros. Morbi sem neque, posuere et pretium eget, bibendum sollicitudin lacus. Aliquam eleifend sollicitudin diam, eu mattis nisl maximus sed. Nulla imperdiet semper molestie. Morbi massa odio, condimentum sed ipsum ac, gravida ultrices erat. Nullam eget dignissim mauris, non tristique erat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;

-
-
- -
-
- - -
-
-
-
-
A modern responsive front-end framework based on Material Design
-
-
-
-
Unsplashed background img 3
-
- -
-
-
-
-
-
-

Location

-

Vestibulum ac diam sit amet quam vehicula elementum sed sit amet dui. Vivamus suscipit tortor eget felis porttitor volutpat.

-
-
-
-
-
-
-

Drop us a line

-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- - -
- - - -