Started adding grapesJS to assistant area for the site view builder.

This commit is contained in:
Llewellyn van der Merwe 2020-02-12 16:27:32 +02:00
parent 4664d89d0e
commit a6cdafb31f
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
17 changed files with 82 additions and 17 deletions

View File

@ -144,14 +144,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 9th February, 2020
+ *Last Build*: 12th February, 2020
+ *Version*: 2.10.11
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **281319**
+ *Line count*: **281346**
+ *Field count*: **1505**
+ *File count*: **1770**
+ *Folder count*: **280**
+ *File count*: **1777**
+ *Folder count*: **283**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -144,14 +144,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 9th February, 2020
+ *Last Build*: 12th February, 2020
+ *Version*: 2.10.11
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **281319**
+ *Line count*: **281346**
+ *Field count*: **1505**
+ *File count*: **1770**
+ *Folder count*: **280**
+ *File count*: **1777**
+ *Folder count*: **283**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -1811,7 +1811,7 @@ class Structure extends Get
// check files exist
if (JFile::exists($this->componentPath . '/admin/models/fields/' . $field['type_name'] . '.php'))
{
// move the custom field
// copy the custom field
JFile::copy($this->componentPath . '/admin/models/fields/' . $field['type_name'] . '.php', $path . '/fields/' . $field['type_name'] . '.php');
}
// do this just once
@ -1823,7 +1823,7 @@ class Structure extends Get
// check files exist
if (JFile::exists($this->componentPath . '/admin/models/rules/' . $this->validationLinkedFields[$field['field']] . '.php'))
{
// move the custom field
// copy the custom field
JFile::copy($this->componentPath . '/admin/models/rules/' . $this->validationLinkedFields[$field['field']] . '.php', $path . '/rules/' . $this->validationLinkedFields[$field['field']] . '.php');
}
// do this just once

View File

@ -3140,7 +3140,10 @@ class Fields extends Structure
public function setCustomFieldTypeFile($data, $view_name_list, $view_name_single)
{
// make sure it is not already been build or if it is prime
if (isset($data['custom']) && isset($data['custom']['extends']) && ((isset($data['custom']['prime_php']) && $data['custom']['prime_php'] == 1) || !isset($this->fileContentDynamic['customfield_' . $data['type']]) || !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_' . $data['type']])))
if (isset($data['custom']) && isset($data['custom']['extends'])
&& ((isset($data['custom']['prime_php']) && $data['custom']['prime_php'] == 1)
|| !isset($this->fileContentDynamic['customfield_' . $data['type']])
|| !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_' . $data['type']])))
{
// set J prefix
$jprefix = 'J';

View File

@ -695,6 +695,7 @@ class Infusion extends Interpretation
// CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT <<<DYNAMIC>>>
$this->fileContentDynamic[$view['settings']->code][$this->hhh . 'CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT' . $this->hhh] = $this->setCustomViewSubmitButtonScript($view);
// setup the templates
$this->setCustomViewTemplateBody($view);

View File

@ -5530,7 +5530,6 @@ COM_COMPONENTBUILDER_ISOLATE="Isolate"
COM_COMPONENTBUILDER_ISSUE="issue"
COM_COMPONENTBUILDER_IS_NOT_ONLY_FOUR_LISTRADIOCHECKBOXES="Is Not (only 4 list/radio/checkboxes)"
COM_COMPONENTBUILDER_IS_ONLY_FOUR_LISTRADIOCHECKBOXES="Is (only 4 list/radio/checkboxes)"
COM_COMPONENTBUILDER_ITEM_DISPLAY="Item Display"
COM_COMPONENTBUILDER_IWEBSITEI_BSB="<i>Website:</i> <b>%s</b>"
COM_COMPONENTBUILDER_JCB_COMMUNITY="JCB Community"
COM_COMPONENTBUILDER_JCB_COMMUNITY_PACKAGES="JCB Community Packages"
@ -8152,6 +8151,7 @@ COM_COMPONENTBUILDER_SHOW_ONLY="Show Only"
COM_COMPONENTBUILDER_SHOW_TOGGLE="Show Toggle"
COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB="Since the owner details are displayed during <b>import process</b> before adding the key, this way if the user/dev <b>does not</b> have the key they can see <b>where to get it</b>."
COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_DOES_NOT_HAVE_THE_KEY_THEY_CAN_SEE_WHERE_TO_GET_IT="Since the owner details are displayed during import process before adding the key, this way if the user/dev does not have the key they can see where to get it."
COM_COMPONENTBUILDER_SINGLE_ITEM_DISPLAY_EDITOR_OF_THE_SITE_VIEW="Single item display editor of the site view"
COM_COMPONENTBUILDER_SITE="Site"
COM_COMPONENTBUILDER_SITE_VIEW="Site View"
COM_COMPONENTBUILDER_SITE_VIEWS="Site Views"

View File

@ -2414,7 +2414,8 @@ INSERT INTO `#__componentbuilder_library_config` (`id`, `addconfig`, `library`,
INSERT INTO `#__componentbuilder_library_files_folders_urls` (`id`, `addfiles`, `addfolders`, `addurls`, `library`, `params`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES
(2, '', '', '{\"addurls0\":{\"url\":\"https:\\/\\/maxcdn.bootstrapcdn.com\\/bootstrap\\/4.0.0-alpha.6\\/js\\/bootstrap.min.js\",\"type\":\"2\"},\"addurls1\":{\"url\":\"https:\\/\\/maxcdn.bootstrapcdn.com\\/bootstrap\\/4.0.0-alpha.6\\/css\\/bootstrap.min.css\",\"type\":\"2\"}}', 2, '', 1, '2017-11-25 16:17:36', '2018-05-02 23:29:05', 11, '', 2),
(3, '', '', '{\"addurls0\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/uikit\\/3.0.0-rc.16\\/js\\/uikit.min.js\",\"type\":\"2\"},\"addurls2\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/uikit\\/3.0.0-rc.16\\/js\\/uikit-icons.min.js\",\"type\":\"2\"},\"addurls4\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/uikit\\/3.0.0-rc.16\\/css\\/uikit.min.css\",\"type\":\"2\"}}', 3, '', 1, '2017-11-25 21:47:40', '2018-09-19 14:22:09', 10, '', 3),
(4, '{}', '{\"addfolders0\":{\"folder\":\"file_icon_vectors\",\"path\":\"\\/media\\/vector\",\"rename\":\"1\"}}', '{}', 7, '', 1, '2019-10-03 09:24:30', '2019-10-03 09:25:39', 2, '', 4);
(4, '{}', '{\"addfolders0\":{\"folder\":\"file_icon_vectors\",\"path\":\"\\/media\\/vector\",\"rename\":\"1\"}}', '{}', 7, '', 1, '2019-10-03 09:24:30', '2019-10-03 09:25:39', 2, '', 4),
(5, '{}', '{}', '{\"addurls0\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/grapesjs\\/0.14.15\\/css\\/grapes.min.css\",\"type\":2},\"addurls2\":{\"url\":\"https:\\/\\/raw.githubusercontent.com\\/artf\\/grapesjs-preset-webpage\\/master\\/dist\\/grapesjs-preset-webpage.min.css\",\"type\":2},\"addurls1\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/grapesjs\\/0.14.15\\/grapes.min.js\",\"type\":2},\"addurls3\":{\"url\":\"https:\\/\\/raw.githubusercontent.com\\/artf\\/grapesjs-preset-webpage\\/master\\/dist\\/grapesjs-preset-webpage.min.js\",\"type\":2}}', 8, '', 1, '2020-02-10 21:34:33', '2020-02-12 13:57:06', 4, '', 5);
CREATE TABLE IF NOT EXISTS `#__componentbuilder_external_code` (

View File

@ -21,6 +21,8 @@ defined('_JEXEC') or die('Restricted access');
</div>
<script type="text/javascript">
var active_view = 'view0';
var active_editors = {};
var last_editors = {};
var created_fields = {};
jQuery(document).on('subform-row-add', function(event, row){
setFieldNames();
@ -33,8 +35,26 @@ function setJCBuilder(area, view, target){
if (target == 2){
setFieldNames();
setListViewFieldOptions();
} else if (target == 3 && !active_editors.hasOwnProperty(view)) {
// update the editor (let grape js know)
initializeGrapesjs();
}
}
function initializeGrapesjs(){
active_editors[active_view] = grapesjs.init({
// Indicate where to init the editor. You can also pass an HTMLElement
container: '#gjs-'+active_view,
// Get the content for the canvas directly from the element
fromElement: true,
// Size of the editor
height: '500px',
width: 'auto',
// Default configurations
storageManager: { autoload: 1 },
// basic block manager
plugins: ['gjs-preset-webpage'],
});
}
function setListViewFieldOptions(){
// build fields
if (created_fields.hasOwnProperty(active_view)){

View File

@ -562,9 +562,8 @@ class ComponentbuilderViewAssistant extends JViewLegacy
$displayAttribute = array(
'type' => 'note',
'name' => 'display',
'label' => 'COM_COMPONENTBUILDER_ITEM_DISPLAY',
'description' => '
<b>More details soon, to help build the site/front display of a single item.</b>',
'label' => 'COM_COMPONENTBUILDER_SINGLE_ITEM_DISPLAY_EDITOR_OF_THE_SITE_VIEW',
'description' => '<div id="gjs-[[[VDM]]]"></div>',
'heading' => 'h5'
);
// load the subform attributes
@ -595,6 +594,12 @@ class ComponentbuilderViewAssistant extends JViewLegacy
// Initialize the header checker.
$HeaderCheck = new componentbuilderHeaderCheck;
// always load these files.
$this->document->addStyleSheet(JURI::root(true) . "/media/com_componentbuilder/grapejs/css/grapes.min.css", (ComponentbuilderHelper::jVersion()->isCompatible("3.8.0")) ? array("version" => "auto") : "text/css");
$this->document->addStyleSheet(JURI::root(true) . "/media/com_componentbuilder/grapejs/css/grapesjs-preset-webpage.min.css", (ComponentbuilderHelper::jVersion()->isCompatible("3.8.0")) ? array("version" => "auto") : "text/css");
$this->document->addScript(JURI::root(true) . "/media/com_componentbuilder/grapejs/js/grapes.min.js", (ComponentbuilderHelper::jVersion()->isCompatible("3.8.0")) ? array("version" => "auto") : "text/javascript");
$this->document->addScript(JURI::root(true) . "/media/com_componentbuilder/grapejs/js/grapesjs-preset-webpage.min.js", (ComponentbuilderHelper::jVersion()->isCompatible("3.8.0")) ? array("version" => "auto") : "text/javascript");
// Add View JavaScript File
$this->document->addScript(JURI::root(true) . "/administrator/components/com_componentbuilder/assets/js/assistant.js", (ComponentbuilderHelper::jVersion()->isCompatible("3.8.0")) ? array("version" => "auto") : "text/javascript");

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>9th February, 2020</creationDate>
<creationDate>12th February, 2020</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
@ -39,6 +39,7 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo
<folder>js</folder>
<folder>css</folder>
<folder>images</folder>
<folder>grapejs</folder>
<folder>uikit-v2</folder>
<folder>footable-v3</folder>
</media>

4
media/grapejs/css/grapes.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
.gjs-one-bg{background-color:#463a3c}.gjs-one-color{color:#463a3c}.gjs-one-color-h:hover{color:#463a3c}.gjs-two-bg{background-color:#b9a5a6}.gjs-two-color{color:#b9a5a6}.gjs-two-color-h:hover{color:#b9a5a6}.gjs-three-bg{background-color:#804f7b}.gjs-three-color{color:#804f7b}.gjs-three-color-h:hover{color:#804f7b}.gjs-four-bg{background-color:#d97aa6}.gjs-four-color{color:#d97aa6}.gjs-four-color-h:hover{color:#d97aa6}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

1
media/grapejs/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

11
media/grapejs/js/grapes.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>