diff --git a/LICENSE b/LICENSE
index 2d75f5ad..c271a453 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,8 +1,16 @@
-Commercial License
+MIT License
-Copyright (c) 2016 Matthew Smith
+Copyright (c) 2019 Matthew Smith
-Licensed for personal and/or commercial with a valid license purchased from respondcms.com.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
diff --git a/app/Http/Controllers/CodeController.php b/app/Http/Controllers/CodeController.php
index ee85f633..a0837494 100644
--- a/app/Http/Controllers/CodeController.php
+++ b/app/Http/Controllers/CodeController.php
@@ -13,7 +13,7 @@
use App\Respond\Models\Page;
// DOM parser
-use Sunra\PhpSimple\HtmlDomParser;
+use KubAT\PhpSimple\HtmlDomParser;
class CodeController extends Controller
{
@@ -389,8 +389,15 @@ public function save(Request $request)
// save to file
file_put_contents($path, $value);
+ // combine css
Publish::combineCSS($site);
+ // re-publish the templates to update date/time stamp
+ Publish::publishTemplates($user, $site);
+
+ // re-publish plugins
+ Publish::publishPlugins($user, $site);
+
// return 200
return response('Ok', 200);
}
@@ -410,6 +417,12 @@ public function save(Request $request)
// combine JS to site.all.js
Publish::combineJS($site);
+ // re-publish the templates to update date/time stamp
+ Publish::publishTemplates($user, $site);
+
+ // re-publish plugins
+ Publish::publishPlugins($user, $site);
+
// return 200
return response('Ok', 200);
}
diff --git a/app/Http/Controllers/EditController.php b/app/Http/Controllers/EditController.php
index ecd13147..d8275ba8 100644
--- a/app/Http/Controllers/EditController.php
+++ b/app/Http/Controllers/EditController.php
@@ -12,7 +12,7 @@
use App\Respond\Models\Setting;
// DOM parser
-use Sunra\PhpSimple\HtmlDomParser;
+use KubAT\PhpSimple\HtmlDomParser;
class EditController extends Controller
{
@@ -188,7 +188,7 @@ public function edit(Request $request)
// set block elements
if($blocks === NULL) {
- $blocks = '.row';
+ $blocks = '.block';
}
// find body element
@@ -301,4 +301,4 @@ public function edit(Request $request)
}
-}
\ No newline at end of file
+}
diff --git a/app/Http/Controllers/SiteController.php b/app/Http/Controllers/SiteController.php
index fb6b151b..e839029d 100644
--- a/app/Http/Controllers/SiteController.php
+++ b/app/Http/Controllers/SiteController.php
@@ -293,7 +293,7 @@ public function reload(Request $request)
// publish plugins
Publish::publishPlugins($user, $site);
- return response('Ok', 200);
+ return response()->json(array());
}
@@ -327,7 +327,7 @@ public function republishTemplates(Request $request)
// re-publish the settings
Publish::publishSettings($user, $site);
- return response('Ok', 200);
+ return response()->json(array());
}
@@ -354,7 +354,7 @@ public function updatePlugins(Request $request)
// re-publish plugins
Publish::publishPlugins($user, $site);
- return response('Ok', 200);
+ return response()->json(array());
}
@@ -379,7 +379,7 @@ public function generateSitemap(Request $request)
// publish site map
Publish::publishSiteMap($user, $site);
- return response('Ok', 200);
+ return response()->json(array());
}
@@ -407,7 +407,7 @@ public function reindexPages(Request $request)
// publish site map
Publish::publishSiteMap($user, $site);
- return response('Ok', 200);
+ return response()->json(array());
}
diff --git a/app/Http/Controllers/ThemeController.php b/app/Http/Controllers/ThemeController.php
index c7d0eca7..1b8c377f 100644
--- a/app/Http/Controllers/ThemeController.php
+++ b/app/Http/Controllers/ThemeController.php
@@ -63,6 +63,9 @@ public function edit(Request $request)
// re-publish the templates
Publish::publishTemplates($user, $site);
+ // re-publish plugins
+ Publish::publishPlugins($user, $site);
+
return response('Ok', 200);
}
diff --git a/app/Respond/Libraries/Publish.php b/app/Respond/Libraries/Publish.php
index 90925002..538e1a71 100644
--- a/app/Respond/Libraries/Publish.php
+++ b/app/Respond/Libraries/Publish.php
@@ -16,7 +16,7 @@
use App\Respond\Models\Theme;
// DOM parser
-use Sunra\PhpSimple\HtmlDomParser;
+use KubAT\PhpSimple\HtmlDomParser;
// Twig Extensions
use App\Respond\Extensions\BetterSortTwigExtension;
@@ -839,7 +839,7 @@ public static function publishPluginsForPage($page, $user, $site, $pages = null)
$html = file_get_contents($location);
- // setup current page
+ // setup meta info
$meta = array(
'url' => $page->url,
'firstName' => $page->firstName,
@@ -849,7 +849,7 @@ public static function publishPluginsForPage($page, $user, $site, $pages = null)
);
// inject plugin HTML to the page
- $dom = Publish::injectPluginHTML($html, $user, $site, $meta, $pages);
+ $dom = Publish::injectPluginHTML($html, $user, $site, $meta, $pages, $page);
// put html back
file_put_contents($location, $dom);
@@ -870,7 +870,7 @@ public static function publishPluginsForPage($page, $user, $site, $pages = null)
* @param {User} $user
* @param {Site} $site
*/
- public static function injectPluginHTML($html, $user, $site, $meta, $pages = null) {
+ public static function injectPluginHTML($html, $user, $site, $meta, $pages = null, $page = null) {
// caches the values of these variables across the request to improve performance
static $forms = array();
@@ -924,8 +924,32 @@ public static function injectPluginHTML($html, $user, $site, $meta, $pages = nul
'timeZone' => $site->timeZone,
);
+ // If page data is provided
+ if($page) {
+
+ // setup current page
+ $current_page = array(
+ 'title' => $page->title,
+ 'description' => $page->description,
+ 'keywords' => $page->keywords,
+ 'callout' => $page->callout,
+ 'url' => $page->url,
+ 'photo' => $page->photo,
+ 'thumb' => $page->thumb,
+ 'language' => $page->language,
+ 'direction' => $page->direction,
+ 'firstName' => $page->firstName,
+ 'lastName' => $page->lastName,
+ 'lastModifiedBy' => $page->lastModifiedBy,
+ 'lastModifiedDate' => $page->lastModifiedDate
+ );
+
+ } else {
+ $current_page = array();
+ }
+
// get plugins for the site
- $dir = app()->basePath().'/public/sites/'.$site->id.'/plugins/';
+ $dir = app()->basePath().'/public/sites/'.$site->id.'/plugins';
$exts = array('html', 'php');
if(!$files) {
@@ -985,7 +1009,7 @@ public static function injectPluginHTML($html, $user, $site, $meta, $pages = nul
if(array_search($el->type, $plugins) !== FALSE) {
// render array
- $render_arr = array('page' => $meta,
+ $render_arr = array('page' => $current_page,
'meta' => $meta,
'site' => $current_site,
'pages' => $pages,
diff --git a/app/Respond/Libraries/Utilities.php b/app/Respond/Libraries/Utilities.php
index 9f526664..fed1b67f 100644
--- a/app/Respond/Libraries/Utilities.php
+++ b/app/Respond/Libraries/Utilities.php
@@ -5,6 +5,8 @@
use \Firebase\JWT\JWT;
use App\Respond\Models\Setting;
+use PHPMailer\PHPMailer\PHPMailer;
+use PHPMailer\PHPMailer\Exception;
class Utilities
{
@@ -364,7 +366,9 @@ public static function sendEmailFromFile($to, $from, $fromName, $subject, $repla
public static function sendEmail($to, $from, $fromName, $subject, $content, $site = NULL)
{
- $mail = new \PHPMailer\PHPMailer\PHPMailer;
+ set_time_limit(30);
+
+ $mail = new PHPMailer(true);
// if null, grab settings from env()
if($site == NULL) {
@@ -470,13 +474,15 @@ public static function sendEmail($to, $from, $fromName, $subject, $content, $sit
$mail->Subject = $subject;
$mail->Body = html_entity_decode($content, ENT_COMPAT, 'UTF-8');
+ $mail->Timeout = 10;
- if (!$mail->send()) {
- return true;
+ try {
+ $mail->send();
+ return true;
+ } catch (Exception $e) {
+ return false;
}
- return false;
-
}
/**
diff --git a/app/Respond/Models/Component.php b/app/Respond/Models/Component.php
index 54173d6b..0bcd2d31 100644
--- a/app/Respond/Models/Component.php
+++ b/app/Respond/Models/Component.php
@@ -9,7 +9,7 @@
use App\Respond\Models\User;
// DOM parser
-use Sunra\PhpSimple\HtmlDomParser;
+use KubAT\PhpSimple\HtmlDomParser;
/**
* Models a component
diff --git a/app/Respond/Models/Page.php b/app/Respond/Models/Page.php
index 45b1dfb6..aabd6b3b 100644
--- a/app/Respond/Models/Page.php
+++ b/app/Respond/Models/Page.php
@@ -14,7 +14,7 @@
use Lullabot\AMP\Validate\Scope;
// DOM parser
-use Sunra\PhpSimple\HtmlDomParser;
+use KubAT\PhpSimple\HtmlDomParser;
/**
* Models a page
@@ -235,13 +235,10 @@ public static function add($data, $site, $user, $replace = NULL){
*/
public static function edit($url, $changes, $site, $user){
- // get a reference to the page object
- $page = Page::GetByUrl($url, $site->id);
-
// get page
$location = app()->basePath().'/public/sites/'.$site->id.'/'.$url.'.html';
- if($page != NULL && file_exists($location)) {
+ if(file_exists($location)) {
// get html
$html = file_get_contents($location);
@@ -255,6 +252,9 @@ public static function edit($url, $changes, $site, $user){
// determine if it is a component
if(isset($el)) {
+ // get a reference to the page object
+ $page = Page::GetByUrl($url, $site->id);
+
// content placeholder
$main_content = '';
@@ -289,6 +289,9 @@ public static function edit($url, $changes, $site, $user){
// set text to main_content
$page->text = $text;
+ // saves the page
+ $page->save($site, $user);
+
}
else {
@@ -303,8 +306,6 @@ public static function edit($url, $changes, $site, $user){
}
- // saves the page
- $page->save($site, $user);
return TRUE;
@@ -388,7 +389,7 @@ public function remove($user, $site){
$json_arr = array_values($pages);
// re-encode json
- $json_text = json_encode($json_arr);
+ $json_text = json_encode($json_arr, JSON_PRETTY_PRINT);
file_put_contents($json_file, $json_text);
@@ -449,9 +450,6 @@ public function injectTemplate($page_html, $site, $user) {
}
- // get font
- $font_script = Publish::getFontScripts($site->id);
-
// replace name and description
$template_html = str_replace('{{page.title}}', $this->title, $template_html);
$template_html = str_replace('{{page.description}}', $this->description, $template_html);
@@ -1091,4 +1089,4 @@ public static function refreshJSON($user, $site) {
}
-}
\ No newline at end of file
+}
diff --git a/app/Respond/Models/Setting.php b/app/Respond/Models/Setting.php
index c7509b07..0215bab0 100644
--- a/app/Respond/Models/Setting.php
+++ b/app/Respond/Models/Setting.php
@@ -9,7 +9,7 @@
use App\Respond\Models\User;
// DOM parser
-use Sunra\PhpSimple\HtmlDomParser;
+use KubAT\PhpSimple\HtmlDomParser;
// Encrypt/Decrypt
use Illuminate\Support\Facades\Crypt;
diff --git a/composer.json b/composer.json
index 8c306aa3..8d70b16f 100644
--- a/composer.json
+++ b/composer.json
@@ -11,7 +11,7 @@
"vlucas/phpdotenv": "~2.2",
"firebase/php-jwt": "dev-master",
"phpmailer/phpmailer": "~6.0",
- "sunra/php-simple-html-dom-parser": "1.5.1",
+ "kub-at/php-simple-html-dom-parser": "^1.7",
"symfony/yaml": "3.0.3",
"alchemy/zippy": "^0.4.9",
"guzzlehttp/guzzle": "^6.2.3",
diff --git a/dist/release.zip b/dist/release.zip
index 609d85a8..7c968777 100644
Binary files a/dist/release.zip and b/dist/release.zip differ
diff --git a/gulpfile.js b/gulpfile.js
index e0ae3550..4df6f3ee 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -6,7 +6,7 @@ let cleanCSS = require('gulp-clean-css');
let concat = require('gulp-concat');
let rename = require('gulp-rename');
-var themes = ['aspire', 'base', 'broadway', 'energy', 'executive', 'highrise', 'market', 'serene', 'sidebar', 'simple', 'stark'];
+var themes = ['aspire', 'broadway', 'sidebar'];
// create a zip for the release
gulp.task('create-zip', function() {
@@ -29,7 +29,7 @@ gulp.task('create-zip', function() {
'public/favicon.ico',
'public/0.959ad71af5481f6e55a8.js',
'public/1.9ab5b33e070fd6ab3012.js',
- 'public/main.c015c854cceff1b4015c.js',
+ 'public/main.8e98d912d8f42923b7f6.js',
'public/polyfills.6fe99e701656a00f4585.js',
'public/runtime.66f28b3f957a74dd3373.js',
'public/scripts.87a01ae09c864179e2ec.js',
@@ -38,16 +38,8 @@ gulp.task('create-zip', function() {
'public/resources/**/*',
'public/editor/**/*',
'public/themes/aspire/**/*',
- 'public/themes/base/**/*',
'public/themes/broadway/**/*',
- 'public/themes/energy/**/*',
- 'public/themes/executive/**/*',
- 'public/themes/highrise/**/*',
- 'public/themes/market/**/*',
- 'public/themes/serene/**/*',
'public/themes/sidebar/**/*',
- 'public/themes/simple/**/*',
- 'public/themes/stark/**/*',
'public/.htaccess',
'public/index.html',
'public/index.php',
@@ -119,4 +111,7 @@ gulp.task('combine', function(done) {
gulp.task('themes', gulp.series(['resources', 'combine']));
// create a zip file for the project in dist/release.zip
-gulp.task('zip', gulp.series(['create-zip']));
\ No newline at end of file
+gulp.task('zip', gulp.series(['create-zip']));
+
+// Default tasks - executed if user types simply "gulp"
+gulp.task('default', gulp.series('resources', 'combine'));
diff --git a/package.json b/package.json
index 49cc0e5e..07ab66e8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "respondcms",
- "version": "6.7.0",
+ "version": "7.3.0",
"repository": "https://github.com/madoublet/respond",
"scripts": {
"tsc": "tsc"
@@ -8,7 +8,7 @@
"license": "ISC",
"dependencies": {},
"devDependencies": {
- "gulp": "github:gulpjs/gulp#4.0",
+ "gulp": "^4.0",
"gulp-clean-css": "^3.9.3",
"gulp-concat": "^2.6.0",
"gulp-minify": "0.0.12",
diff --git a/public/assets/i18n/en.json b/public/assets/i18n/en.json
index 5712c337..278749c0 100644
--- a/public/assets/i18n/en.json
+++ b/public/assets/i18n/en.json
@@ -142,7 +142,7 @@
"Passcode invalid": "Passcode invalid",
"The email and password combination is invalid": "The email and password combination is invalid",
"Success!": "Success!",
- "You're session has expired. Please login again.": "You're session has expired. Please login again.",
+ "Your session has expired. Please login again.": "Your session has expired. Please login again.",
"Sorry, you encountered an error. Contact your site administrator if the problem continues.": "Sorry, you encountered an error. Contact your site administrator if the problem continues.",
"Trial started.": "Trial started.",
"days remaining.": "days remaining.",
diff --git a/public/assets/i18n/fr-FR.json b/public/assets/i18n/fr-FR.json
index 01f6617a..508eb4b3 100644
--- a/public/assets/i18n/fr-FR.json
+++ b/public/assets/i18n/fr-FR.json
@@ -106,6 +106,68 @@
"View Site": "Voir le site",
"Re-publish plugins": "Générer de nouveau les plugins",
"Re-publish sitemap": "Générer de nouveau le plan du site",
- "All themes": "Tous les thèmes",
- "Success!": "Succès!"
+ "All themes": "Tous les thèmes",
+ "Success!": "Succès!",
+ "Templates": "Modèles",
+ "Plugins": "Plugins",
+ "Save": "Enregistrer",
+ "Save and Exit": "Enregistrer et quitter",
+ "Code": "Code",
+ "Add Code": "Ajouter Code",
+ "Template": "Modèle",
+ "Components": "Composants",
+ "Add Component": "Ajouter Composant",
+ "Remove Component": "Supprimer composant",
+ "Tags": "Marques",
+ "Or": "Ou",
+ "Remove Plugin": "Supprimer Plugin",
+ "Edit HTML": "Modifier HTML",
+ "Page Settings": "Paramètres de la Page",
+ "Keywords": "Mots clés",
+ "Direction": "Direction",
+ "Left-to-Right": "De gauche à droite",
+ "Right-to-Left": "De droite à gauche",
+ "Logo": "Logo",
+ "Icon": "Icône",
+ "Color": "Couleur",
+ "Primary logo of the site": "Logo principal du site",
+ "The favicon used for the site": "Le favicon utilisé pour le site",
+ "The color used as the Android application color": "La couleur utilisée comme couleur de l'application Android",
+ "You have multiple sites registered with this email. Key the name of the site above to login. You can speed up the process in the future by navigating to login/site-name.": "Vous avez plusieurs sites enregistrés avec cet e-mail. Saisissez le nom du site ci-dessus pour vous connecter. À l'avenir, vous pouvez accélérer le processus en accédant à login/nom-du-site.",
+ "reCAPTCHA invalid": "reCAPTCHA invalide",
+ "Passcode invalid": "Mot de passe invalide",
+ "The email and password combination is invalid": "La combinaison e-mail et mot de passe n'est pas valide",
+ "Your session has expired. Please login again.": "Votre session a expiré. Veuillez-vous reconnecter.",
+ "Sorry, you encountered an error. Contact your site administrator if the problem continues.": "Désolé, vous avez rencontré une erreur. Contactez l'administrateur du site si le problème continue.",
+ "Trial started.": "Procès commencé.",
+ "days remaining.": "jours restants.",
+ "Activate now.": "Activer maintenant.",
+ "Subscription expired.": "L'abonnement a expiré.",
+ "Unauthorized": "Non autorisé",
+ "Password mismatch": "Non concordance des mots de passe",
+ "Unsubscribe": "Se désabonner",
+ "Confirm you want to Unsubscribe.": "Confirmez que vous souhaitez vous désinscrire.",
+ "Products": "Produits",
+ "Add Product": "Ajouter produit",
+ "SKU": "SKU",
+ "Is Shipped?": "Est Expédié?",
+ "Price": "Prix",
+ "Is Subscription?": "Est l'abonnement?",
+ "Stripe Plan": "Plan Stripe",
+ "Display Plan Price": "Afficher le Prix du Plan",
+ "Remove Product": "Supprimer Produit",
+ "Order updated successfully": "Commande mise à jour avec succès",
+ "Confirm": "Confirmer",
+ "You may have unsaved changes. Do you want to continue?": "Vous avez peut-être des modifications non-enregistrées. Voulez-vous continuer?",
+ "Search by File Name": "Recherche par Nom de Fichier",
+ "Do not include extension (e.g.: .html)": "Ne pas inclure d'extension (par exemple: .html)",
+ "Code Only?": "Code Seulement?",
+ "Set code only for more complicated code not meant to render in the visual editor.": "Choisissez l'option Code Seulement pour le code plus compliqué qui n'est pas destiné à être rendu dans l'éditeur visuel.",
+ "Remove Element?": "Supprimer Element?",
+ "Remove Layout?": "Supprimer Plan?",
+ "Block": "Bloquer",
+ "Text Color": "Couleur du texte",
+ "Text Shadow": "Ombre de texte",
+ "Reset": "Réinitialiser",
+ "Show": "Afficher"
}
diff --git a/public/assets/i18n/fr.json b/public/assets/i18n/fr.json
index 3cbd80a1..82bdcf2d 100644
--- a/public/assets/i18n/fr.json
+++ b/public/assets/i18n/fr.json
@@ -106,5 +106,68 @@
"View Site": "Voir le site",
"Re-publish plugins": "Générer de nouveau les plugins",
"Re-publish sitemap": "Générer de nouveau le plan du site",
- "All themes": "Tous les thèmes"
+ "All themes": "Tous les thèmes",
+ "Templates": "Modèles",
+ "Plugins": "Plugins",
+ "Save": "Enregistrer",
+ "Save and Exit": "Enregistrer et quitter",
+ "Code": "Code",
+ "Add Code": "Ajouter Code",
+ "Template": "Modèle",
+ "Components": "Composants",
+ "Add Component": "Ajouter Composant",
+ "Remove Component": "Supprimer composant",
+ "Tags": "Marques",
+ "Or": "Ou",
+ "Remove Plugin": "Supprimer Plugin",
+ "Edit HTML": "Modifier HTML",
+ "Page Settings": "Paramètres de la Page",
+ "Keywords": "Mots clés",
+ "Direction": "Direction",
+ "Left-to-Right": "De gauche à droite",
+ "Right-to-Left": "De droite à gauche",
+ "Logo": "Logo",
+ "Icon": "Icône",
+ "Color": "Couleur",
+ "Primary logo of the site": "Logo principal du site",
+ "The favicon used for the site": "Le favicon utilisé pour le site",
+ "The color used as the Android application color": "La couleur utilisée comme couleur de l'application Android",
+ "You have multiple sites registered with this email. Key the name of the site above to login. You can speed up the process in the future by navigating to login/site-name.": "Vous avez plusieurs sites enregistrés avec cet e-mail. Saisissez le nom du site ci-dessus pour vous connecter. À l'avenir, vous pouvez accélérer le processus en accédant à login/nom-du-site.",
+ "reCAPTCHA invalid": "reCAPTCHA invalide",
+ "Passcode invalid": "Mot de passe invalide",
+ "The email and password combination is invalid": "La combinaison e-mail et mot de passe n'est pas valide",
+ "Success!": "Succès!",
+ "Your session has expired. Please login again.": "Votre session a expiré. Veuillez-vous reconnecter.",
+ "Sorry, you encountered an error. Contact your site administrator if the problem continues.": "Désolé, vous avez rencontré une erreur. Contactez l'administrateur du site si le problème continue.",
+ "Trial started.": "Procès commencé.",
+ "days remaining.": "jours restants.",
+ "Activate now.": "Activer maintenant.",
+ "Subscription expired.": "L'abonnement a expiré.",
+ "Unauthorized": "Non autorisé",
+ "Password mismatch": "Non concordance des mots de passe",
+ "Unsubscribe": "Se désabonner",
+ "Confirm you want to Unsubscribe.": "Confirmez que vous souhaitez vous désinscrire.",
+ "Products": "Produits",
+ "Add Product": "Ajouter produit",
+ "SKU": "SKU",
+ "Is Shipped?": "Est Expédié?",
+ "Price": "Prix",
+ "Is Subscription?": "Est l'abonnement?",
+ "Stripe Plan": "Plan Stripe",
+ "Display Plan Price": "Afficher le Prix du Plan",
+ "Remove Product": "Supprimer Produit",
+ "Order updated successfully": "Commande mise à jour avec succès",
+ "Confirm": "Confirmer",
+ "You may have unsaved changes. Do you want to continue?": "Vous avez peut-être des modifications non-enregistrées. Voulez-vous continuer?",
+ "Search by File Name": "Recherche par Nom de Fichier",
+ "Do not include extension (e.g.: .html)": "Ne pas inclure d'extension (par exemple: .html)",
+ "Code Only?": "Code Seulement?",
+ "Set code only for more complicated code not meant to render in the visual editor.": "Choisissez l'option Code Seulement pour le code plus compliqué qui n'est pas destiné à être rendu dans l'éditeur visuel.",
+ "Remove Element?": "Supprimer Element?",
+ "Remove Layout?": "Supprimer Plan?",
+ "Block": "Bloquer",
+ "Text Color": "Couleur du texte",
+ "Text Shadow": "Ombre de texte",
+ "Reset": "Réinitialiser",
+ "Show": "Afficher"
}
diff --git a/public/editor/editor.css b/public/editor/editor.css
index 3713da96..1deeca52 100644
--- a/public/editor/editor.css
+++ b/public/editor/editor.css
@@ -162,81 +162,96 @@
}
/* editor-element-menu */
-body [role=main] .editor-element-menu {
+body .editor-element-menu {
font-family: 'Open Sans', sans-serif !important;
position: absolute;
top: 0;
- right: 0;
- background-color: #09203f;
+ left: 0;
margin: 0 !important;
- padding: 0 !important;
- color: #888;
+ padding: 5px !important;
+ color: #24344C;
z-index: 10000;
- visibility: hidden;
opacity: 0;
+ visibility: hidden;
margin: 0 !important;
- font-size: 12px !important;
+ font-size: 13px !important;
line-height: normal !important;
- border-radius: 20px;
- transition: all .1s ease;
- width: auto;
height: auto;
z-index: 20000;
-}
-
- body [role=main] [editor-element] .editor-element-menu x-respond-menu-label {
- position: relative;
- font-family: 'Open Sans', sans-serif !important;
+ text-align: right;
+ background-color: #24344C !important;
display: inline-block;
- font-size: 10px !important;
- color: #fff;
- margin: 0 15px 0 0 !important;
- padding: 12px 0 12px 25px !important;
- text-transform: uppercase;
- line-height: normal !important;
- font-weight: normal !important;
- }
-
-
- body [role=main] [editor-element]:hover .editor-element-menu {
- visibility: visible;
- opacity: 0.75;
- }
+ transform: translateY(5px);
+ border-radius: 5px;
+ border: 2px solid rgba(255,255,255,0.25);
+}
- body [role=main] [editor-element]:hover .editor-element-menu:hover {
+ body .editor-element-menu[active] {
+ display: inline-block !important;
opacity: 1;
+ visibility: visible;
+ transform: translateY(0);
+ transition: all .1s ease;
}
- body [role=main] [editor-element] .editor-element-menu .editor-element-menu-item {
+ body .editor-element-menu .editor-element-menu-item {
font-family: 'Open Sans', sans-serif !important;
position: relative;
display: inline-block;
color: #fff;
- font-size: 12px !important;
- margin: 0 15px 0 0 !important;
- padding: 10px 0 10px 30px !important;
+ font-size: 14px !important;
+ margin: 0 !important;
+ padding: 0 !important;
cursor: pointer;
font-weight: normal;
- line-height: normal !important;
+ width: 35px !important;
+ height: 35px !important;
+ line-height: 37px !important;
+ text-align: center !important;
+ text-shadow: none !important;
+ border-radius: 2px;
}
- body [role=main] [editor-element] .editor-element-menu .editor-element-menu-item.editor-move {
- cursor: move;
+ body .editor-element-menu .editor-element-menu-item:hover {
+ background-color: rgba(255,255,255,0.25);
}
- body [role=main] [editor-element] .editor-element-menu .editor-element-menu-item x-respond-menu-icon {
- position: absolute;
- top: 11px;
- left: 10px;
- margin: 0 !important;
- padding: 0 !important;
+ body .editor-element-menu .editor-element-menu-item.editor-add {
+ background-color: #AECA20 !important;
+ border-radius: 2px;
+ }
+
+ body .editor-element-menu .editor-element-menu-item.editor-remove:hover {
+ background-color: #CF4647 !important;
+ }
+
+ body .editor-element-menu .editor-element-menu-item x-respond-menu-icon {
font-size: 14px !important;
- line-height: normal !important;
}
- body [role=main] [editor-element] .editor-element-menu .editor-element-menu-item {
- display: inline-block;
- text-transform: none !important;
+/* drag */
+[editor-element] .editor-move {
+ position: absolute !important;
+ display: block !important;
+ top: 0 !important;
+ right: 0 !important;
+ width: 30px !important;
+ height: 30px !important;
+ line-height: 30px !important;
+ margin: 0 !important;
+ background: #AECA20 !important;
+ color: #fff !important;
+ cursor: move !important;
+ text-align: center !important !important;
+ border-radius: 50% !important;
+}
+
+ [editor-element] .editor-move i {
+ margin: 0 !important;
+ padding: 0 !important;
+ font-size: 13px !important;
+ user-select: none !important; /* Standard */
+ pointer-events: none !important;
}
/* highlight */
diff --git a/public/editor/editor.js b/public/editor/editor.js
index 38554eb8..1b79eb7b 100644
--- a/public/editor/editor.js
+++ b/public/editor/editor.js
@@ -184,6 +184,56 @@ editor = (function() {
},
+ /**
+ * Sets up the element
+ * @param {DOMElement} el
+ */
+ setupElement: function(el) {
+
+ // set element
+ el.setAttribute('editor-element', '');
+
+ },
+
+
+ /**
+ * Hides the element menu
+ * @param {DOMElement} el
+ */
+ hideElementMenu: function() {
+ editor.current.menu.removeAttribute('active');
+ },
+
+ /**
+ * Positions the element menu
+ * @param {DOMElement} el
+ */
+ positionElementMenu: function(el) {
+
+ var rect = el.getBoundingClientRect();
+
+ var top = Math.round(rect.top + window.scrollY) - 50;
+ var left = Math.round(rect.left);
+
+
+ editor.current.menu.removeAttribute('active');
+ editor.current.menu.style.top = top + 'px';
+ editor.current.menu.style.left = left + 'px';
+
+ setTimeout(function() {
+ editor.current.menu.setAttribute('active', '')
+ }, 100);
+
+
+ // dispose of handle
+ el = document.querySelector('[editor-element] .editor-move');
+
+ if(el) {
+ el.remove();
+ }
+
+ },
+
/**
* Adds an element menu to a given element
* @param {DOMElement} el
@@ -192,28 +242,137 @@ editor = (function() {
var menu, span;
- // set element
- el.setAttribute('editor-element', '');
-
// create element menu
menu = document.createElement('x-respond-menu');
menu.setAttribute('class', 'editor-element-menu');
menu.setAttribute('contentEditable', 'false');
+ // create a handle
+ span = document.createElement('x-respond-menu-item');
+ span.setAttribute('class', 'editor-element-menu-item editor-remove');
+ span.innerHTML = '