Skip to content

Commit

Permalink
Add Tiny Mce licence key management
Browse files Browse the repository at this point in the history
  • Loading branch information
jf-viguier committed Feb 22, 2024
1 parent 1b09f03 commit 510854c
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
2 changes: 2 additions & 0 deletions _dev/src/components/FieldRepeater.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const removeTinyNotifications = () => {
})
}, 300)
}
let tinymce_api_key = ref(window.security_app.tinymce_api_key)
</script>

<template>
Expand All @@ -79,6 +80,7 @@ const removeTinyNotifications = () => {
<div class="pb-4"> {{ f.label }} </div>
<Editor
v-model="f.value"
:api-key="tinymce_api_key"
@init="removeTinyNotifications()"
:init="{
height: 500,
Expand Down
20 changes: 19 additions & 1 deletion prettyblocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ class PrettyBlocks extends Module implements WidgetInterface
'displayRightColumn',
'actionDispatcher',
'actionFrontControllerSetVariables',
'ActionRegisterThemeSettings',
];

public function __construct()
{
$this->name = 'prettyblocks';
$this->tab = 'administration';
$this->version = '2.2.0';
$this->version = '2.2.1';
$this->author = 'PrestaSafe';
$this->need_instance = 1;
$this->js_path = $this->_path . 'views/js/';
Expand Down Expand Up @@ -279,4 +280,21 @@ public static function renderZone($params)

return $context->smarty->fetch('module:prettyblocks/views/templates/front/zone.tpl');
}

/**
* Hook for adding theme settings
* quick fix for adding tinyMCE api key.
*/
public function hookActionRegisterThemeSettings()
{
return [
'tinymce_api_key' => [
'type' => 'text', // type of field
'label' => $this->l('TinyMCE api key'), // label to display
'description' => $this->l('Add your TinyMCE api key (free) https://www.tiny.cloud/pricing/'), // description to display
'tab' => 'Settings',
'default' => 'no-api-key', // default value (Boolean)
],
];
}
}
1 change: 1 addition & 0 deletions src/Controller/AdminThemeManagerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ public function indexAction()
'security_app' => [
'ajax_token' => \Configuration::get('_PRETTYBLOCKS_TOKEN_'),
'prettyblocks_version' => $module->version,
'tinymce_api_key' => \TplSettings::getSettings('tinymce_api_key') ?? 'no-api-key',
],
'css_build' => $css,
'js_build' => $js,
Expand Down
37 changes: 37 additions & 0 deletions upgrade/upgrade-2.2.1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Copyright (c) Since 2020 PrestaSafe and contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to contact@prestasafe.com so we can send you a copy immediately.
*
* @author PrestaSafe <contact@prestasafe.com>
* @copyright Since 2020 PrestaSafe and contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaSafe
*/
if (!defined('_PS_VERSION_')) {
exit;
}

/**
* @param prettyblocks $module
*
* @return bool|string
*
* @throws PrestaShopDatabaseException
* @throws PrestaShopException
*/
function upgrade_module_2_2_1($module)
{
$module->registerHook('ActionRegisterThemeSettings');

return true;
}

0 comments on commit 510854c

Please sign in to comment.