Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Correct the use one or more "RichText" on the page #559

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions assets/lib/class.modxRTEbridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,31 +216,34 @@ public function getEditorScript()
$ph['configRawString'] = $this->renderConfigRawString();
$ph['editorKey'] = $this->editorKey;
$ph['themeKey'] = $this->theme;
$ph['selector'] = $selector;
$ph['selector'][] = $selector;
$ph['documentIdentifier'] = $modx->documentIdentifier;

$ph = array_merge($ph, $this->customPlaceholders, $this->mergeParamArrays()); // Big list..

// Init only once at all - Load Editors-Library, CSS etc
if (!defined($this->editorKey . '_INIT_ONCE')) {
define($this->editorKey . '_INIT_ONCE', 1);
$output .= file_get_contents("{$this->pluginParams['base_path']}tpl/tpl.{$this->editorKey}.init_once.html") ."\n";
if (!empty($this->initOnceArr)) {
$output .= implode("\n", $this->initOnceArr);
}
}

// Init only once per config (enables multiple config-objects i.e. for richtext / richtextmini via [+configJs+])
if (!defined($this->editorKey . '_INIT_CONFIG_' . $this->theme)) {
define($this->editorKey . '_INIT_CONFIG_' . $this->theme, 1);
$output .= file_get_contents("{$this->pluginParams['base_path']}tpl/tpl.{$this->editorKey}.config.html") ."\n";
}

// Array of selectors
$ph['selector'] = implode(','.$ph['selectorPrefix'], $ph['selector']);

// Init only once at all - Load Editors-Library, CSS etc
if (!defined($this->editorKey . '_INIT_ONCE')) {
define($this->editorKey . '_INIT_ONCE', 1);
$output .= file_get_contents("{$this->pluginParams['base_path']}tpl/tpl.{$this->editorKey}.init_once.html") ."\n";
if (!empty($this->initOnceArr)) {
$output .= implode("\n", $this->initOnceArr);
}
}

// Loop through tvs
$output .= file_get_contents("{$this->pluginParams['base_path']}tpl/tpl.{$this->editorKey}.init.html") ."\n";
$output = $modx->parseText($output, $ph);
// Init only once per config (enables multiple config-objects i.e. for richtext / richtextmini via [+configJs+])
if (!defined($this->editorKey . '_INIT_CONFIG_' . $this->theme)) {
define($this->editorKey . '_INIT_CONFIG_' . $this->theme, 1);
$output .= file_get_contents("{$this->pluginParams['base_path']}tpl/tpl.{$this->editorKey}.config.html") ."\n";
}

// Loop through tvs
$output .= file_get_contents("{$this->pluginParams['base_path']}tpl/tpl.{$this->editorKey}.init.html") ."\n";
$output = $modx->parseText($output, $ph);

} else {
exit; // @todo: prepare for editors that need no elements
}
Expand Down Expand Up @@ -901,4 +904,4 @@ public function saveContentProcessor($rid, $ppPluginName, $ppEditableIds='editab
return 'Not logged into manager!';
}
}
}
}