19 include_once($ROOT_PATH.
'wysiwyg_plugin.inc');
46 wysiwyg_plugin::wysiwyg_plugin($wysiwyg);
47 $this->_add_button(
'quotation',
'Quotation',
'Quotation',
'false',
'60');
61 <script type=
"text/javascript" language=
"Javascript">
63 HTMLArea.prototype._insertBlockquote =
function() {
66 var selection = this.getSelectedHTML();
67 var parent = this.getParentElement();
70 var inside_blockquote =
false;
71 var ancestors = this.getAllAncestors();
72 for (var i = ancestors.length; --i >= 0;) {
73 var el = ancestors[i];
76 if (el && el.tagName ==
"BLOCKQUOTE") {
77 var pattern =
new RegExp(
"<blockquote>\r?\n?"+el.innerHTML+
"\r?\n?<\/blockquote>",
"i");
78 el.parentNode.innerHTML = el.parentNode.innerHTML.replace(pattern, el.innerHTML);
79 inside_blockquote =
true;
85 var pattern = /(<blockquote>\r?\n?.*?\r?\n?<\/blockquote>)|(\r?\n?<blockquote \/>)/i;
86 if (pattern.test(selection)) {
87 inside_blockquote =
true;
89 for (var i = parent.childNodes.length; --i >= 0;) {
90 if (parent.childNodes[i].tagName ==
"BLOCKQUOTE") {
91 nodeContent = parent.childNodes[i].innerHTML;
93 pattern =
new RegExp(
"<blockquote>\r?\n?"+nodeContent+
"\r?\n?<\/blockquote>",
"i");
94 parent.childNodes[i].parentNode.innerHTML = parent.childNodes[i].parentNode.innerHTML.replace(pattern, nodeContent);
99 if (!inside_blockquote) {
101 if (parent.tagName ==
"P") {
102 var parent_html = parent.innerHTML;
103 parent_html = parent_html.replace(/^\s*/,
"").replace(/\s*$/,
"");
106 if (HTMLArea.is_ie) {
109 re =
new RegExp(e,
"i");
110 selection = selection.replace(re,
"");
113 var re =
new RegExp(e,
"i");
114 selection = selection.replace(re,
"");
116 re =
new RegExp(e,
"i");
117 selection = selection.replace(re,
"");
119 selection = selection.replace(/^\s*/,
"").replace(/\s*$/,
"");
121 if (parent_html == selection) {
124 var blockquote = this._doc.createElement(
"blockquote");
125 var paragraph = this._doc.createElement(
"p");
126 paragraph.innerHTML = selection;
127 blockquote.appendChild(paragraph);
129 var parent_parent = parent.parentNode;
130 parent_parent.insertBefore(blockquote, parent);
131 parent_parent.removeChild(parent);
133 alert(
"<BLOCKQUOTE> tags cannot be added to partial text within a paragraph.");
138 this.surroundHTML(
'<blockquote>',
'</blockquote>');
158 this._insertBlockquote();