diff --git a/composer.json b/composer.json
index 01a41a0..74ffc22 100644
--- a/composer.json
+++ b/composer.json
@@ -13,6 +13,6 @@
}
},
"extra": {
- "examples": ["ckeditor.php"]
+ "examples": ["ckeditor.php", "ckeditor2.php"]
}
}
diff --git a/examples/ckeditor2.php b/examples/ckeditor2.php
new file mode 100644
index 0000000..da9e189
--- /dev/null
+++ b/examples/ckeditor2.php
@@ -0,0 +1,34 @@
+txtEditor = new QCKEditor($this);
+ $this->txtEditor->Text = 'Something to start with.';
+ $this->txtEditor->Configuration = 'ckConfig';
+
+ $this->btnSubmit = new QButton($this);
+ $this->btnSubmit->Text = "Submit";
+ $this->btnSubmit->AddAction(new QClickEvent(), new QAjaxAction('submit_click'));
+
+ $this->pnlResult = new QPanel($this);
+ $this->pnlResult->HtmlEntities = true;
+ }
+
+ protected function submit_click($strFormId, $strControlId, $param) {
+ $this->pnlResult->Text = $this->txtEditor->Text;
+ }
+ }
+
+ SampleForm2::Run('SampleForm2');
diff --git a/examples/ckeditor2.tpl.php b/examples/ckeditor2.tpl.php
new file mode 100644
index 0000000..b80be49
--- /dev/null
+++ b/examples/ckeditor2.tpl.php
@@ -0,0 +1,25 @@
+
+
+
+
+ RenderBegin(); ?>
+
+
+
QCKEditor: Implementation of the CKEditor HTML editor.
+
+ QCKEditor implements the CKEditor HTML editor. It allows you
+ to create a text editing block with full HTML editing capabilities. The text returned from it is HTML.
+
+ txtEditor->Render(); ?>
+ btnSubmit->Render(); ?>
+
The HTML you typed:
+ pnlResult->Render(); ?>
+
+
+RenderEnd(); ?>
+
\ No newline at end of file
diff --git a/includes/QCKEditorBase.php b/includes/QCKEditorBase.php
index 67e7822..866ea2f 100644
--- a/includes/QCKEditorBase.php
+++ b/includes/QCKEditorBase.php
@@ -8,6 +8,7 @@
class QCKEditorBase extends \QTextBoxBase {
protected $strJsReadyFunc = 'function(){}';
+ protected $strConfiguration = '{}';
public function __construct($objParentObject, $strControlId = null) {
parent::__construct($objParentObject, $strControlId);
@@ -36,7 +37,7 @@ public function GetControlJavaScript() {
$strReadyFunc = $this->strJsReadyFunc;
}
$strJs = "function() {qcubed.qckeditor(this, '{$strFormId}', '{$strControlId}', {$strReadyFunc});}";
- return sprintf('jQuery("#%s").%s(%s)', $this->getJqControlId(), $this->getJqSetupFunction(), $strJs);
+ return sprintf('jQuery("#%s").%s(%s, %s)', $this->getJqControlId(), $this->getJqSetupFunction(), $strJs, $this->strConfiguration);
}
public function GetEndScript() {
@@ -59,6 +60,18 @@ public function __set($strName, $mixValue) {
}
break;
+ case "Configuration":
+ // The configuration string. Could be a name of an object, or a javascript object (sourrounded by braces {})
+ try {
+ $this->strConfiguration = \QType::Cast($mixValue, \QType::String);
+ break;
+ } catch (QInvalidCastException $objExc) {
+ $objExc->IncrementOffset();
+ throw $objExc;
+ }
+ break;
+
+
default:
try {
parent::__set($strName, $mixValue);