tinymce_splitblockquote 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +280 -0
- data/LICENSE +4 -0
- data/README.rdoc +33 -0
- data/Rakefile +27 -0
- data/lib/assets/COPYING +280 -0
- data/lib/assets/LICENSE +4 -0
- data/lib/assets/README.md +59 -0
- data/lib/assets/tiny_mce/plugins/splitblockquote/editor_plugin.js +1 -0
- data/lib/assets/tiny_mce/plugins/splitblockquote/editor_plugin_src.js +213 -0
- data/lib/tinymce_splitblockquote.rb +46 -0
- data/tinymce_splitblockquote.gemspec +50 -0
- metadata +93 -0
data/COPYING
ADDED
@@ -0,0 +1,280 @@
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
2
|
+
Version 2, June 1991
|
3
|
+
|
4
|
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6
|
+
Everyone is permitted to copy and distribute verbatim copies
|
7
|
+
of this license document, but changing it is not allowed.
|
8
|
+
|
9
|
+
Preamble
|
10
|
+
|
11
|
+
The licenses for most software are designed to take away your
|
12
|
+
freedom to share and change it. By contrast, the GNU General Public
|
13
|
+
License is intended to guarantee your freedom to share and change free
|
14
|
+
software--to make sure the software is free for all its users. This
|
15
|
+
General Public License applies to most of the Free Software
|
16
|
+
Foundation's software and to any other program whose authors commit to
|
17
|
+
using it. (Some other Free Software Foundation software is covered by
|
18
|
+
the GNU Lesser General Public License instead.) You can apply it to
|
19
|
+
your programs, too.
|
20
|
+
|
21
|
+
When we speak of free software, we are referring to freedom, not
|
22
|
+
price. Our General Public Licenses are designed to make sure that you
|
23
|
+
have the freedom to distribute copies of free software (and charge for
|
24
|
+
this service if you wish), that you receive source code or can get it
|
25
|
+
if you want it, that you can change the software or use pieces of it
|
26
|
+
in new free programs; and that you know you can do these things.
|
27
|
+
|
28
|
+
To protect your rights, we need to make restrictions that forbid
|
29
|
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30
|
+
These restrictions translate to certain responsibilities for you if you
|
31
|
+
distribute copies of the software, or if you modify it.
|
32
|
+
|
33
|
+
For example, if you distribute copies of such a program, whether
|
34
|
+
gratis or for a fee, you must give the recipients all the rights that
|
35
|
+
you have. You must make sure that they, too, receive or can get the
|
36
|
+
source code. And you must show them these terms so they know their
|
37
|
+
rights.
|
38
|
+
|
39
|
+
We protect your rights with two steps: (1) copyright the software, and
|
40
|
+
(2) offer you this license which gives you legal permission to copy,
|
41
|
+
distribute and/or modify the software.
|
42
|
+
|
43
|
+
Also, for each author's protection and ours, we want to make certain
|
44
|
+
that everyone understands that there is no warranty for this free
|
45
|
+
software. If the software is modified by someone else and passed on, we
|
46
|
+
want its recipients to know that what they have is not the original, so
|
47
|
+
that any problems introduced by others will not reflect on the original
|
48
|
+
authors' reputations.
|
49
|
+
|
50
|
+
Finally, any free program is threatened constantly by software
|
51
|
+
patents. We wish to avoid the danger that redistributors of a free
|
52
|
+
program will individually obtain patent licenses, in effect making the
|
53
|
+
program proprietary. To prevent this, we have made it clear that any
|
54
|
+
patent must be licensed for everyone's free use or not licensed at all.
|
55
|
+
|
56
|
+
The precise terms and conditions for copying, distribution and
|
57
|
+
modification follow.
|
58
|
+
|
59
|
+
GNU GENERAL PUBLIC LICENSE
|
60
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61
|
+
|
62
|
+
0. This License applies to any program or other work which contains
|
63
|
+
a notice placed by the copyright holder saying it may be distributed
|
64
|
+
under the terms of this General Public License. The "Program", below,
|
65
|
+
refers to any such program or work, and a "work based on the Program"
|
66
|
+
means either the Program or any derivative work under copyright law:
|
67
|
+
that is to say, a work containing the Program or a portion of it,
|
68
|
+
either verbatim or with modifications and/or translated into another
|
69
|
+
language. (Hereinafter, translation is included without limitation in
|
70
|
+
the term "modification".) Each licensee is addressed as "you".
|
71
|
+
|
72
|
+
Activities other than copying, distribution and modification are not
|
73
|
+
covered by this License; they are outside its scope. The act of
|
74
|
+
running the Program is not restricted, and the output from the Program
|
75
|
+
is covered only if its contents constitute a work based on the
|
76
|
+
Program (independent of having been made by running the Program).
|
77
|
+
Whether that is true depends on what the Program does.
|
78
|
+
|
79
|
+
1. You may copy and distribute verbatim copies of the Program's
|
80
|
+
source code as you receive it, in any medium, provided that you
|
81
|
+
conspicuously and appropriately publish on each copy an appropriate
|
82
|
+
copyright notice and disclaimer of warranty; keep intact all the
|
83
|
+
notices that refer to this License and to the absence of any warranty;
|
84
|
+
and give any other recipients of the Program a copy of this License
|
85
|
+
along with the Program.
|
86
|
+
|
87
|
+
You may charge a fee for the physical act of transferring a copy, and
|
88
|
+
you may at your option offer warranty protection in exchange for a fee.
|
89
|
+
|
90
|
+
2. You may modify your copy or copies of the Program or any portion
|
91
|
+
of it, thus forming a work based on the Program, and copy and
|
92
|
+
distribute such modifications or work under the terms of Section 1
|
93
|
+
above, provided that you also meet all of these conditions:
|
94
|
+
|
95
|
+
a) You must cause the modified files to carry prominent notices
|
96
|
+
stating that you changed the files and the date of any change.
|
97
|
+
|
98
|
+
b) You must cause any work that you distribute or publish, that in
|
99
|
+
whole or in part contains or is derived from the Program or any
|
100
|
+
part thereof, to be licensed as a whole at no charge to all third
|
101
|
+
parties under the terms of this License.
|
102
|
+
|
103
|
+
c) If the modified program normally reads commands interactively
|
104
|
+
when run, you must cause it, when started running for such
|
105
|
+
interactive use in the most ordinary way, to print or display an
|
106
|
+
announcement including an appropriate copyright notice and a
|
107
|
+
notice that there is no warranty (or else, saying that you provide
|
108
|
+
a warranty) and that users may redistribute the program under
|
109
|
+
these conditions, and telling the user how to view a copy of this
|
110
|
+
License. (Exception: if the Program itself is interactive but
|
111
|
+
does not normally print such an announcement, your work based on
|
112
|
+
the Program is not required to print an announcement.)
|
113
|
+
|
114
|
+
These requirements apply to the modified work as a whole. If
|
115
|
+
identifiable sections of that work are not derived from the Program,
|
116
|
+
and can be reasonably considered independent and separate works in
|
117
|
+
themselves, then this License, and its terms, do not apply to those
|
118
|
+
sections when you distribute them as separate works. But when you
|
119
|
+
distribute the same sections as part of a whole which is a work based
|
120
|
+
on the Program, the distribution of the whole must be on the terms of
|
121
|
+
this License, whose permissions for other licensees extend to the
|
122
|
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123
|
+
|
124
|
+
Thus, it is not the intent of this section to claim rights or contest
|
125
|
+
your rights to work written entirely by you; rather, the intent is to
|
126
|
+
exercise the right to control the distribution of derivative or
|
127
|
+
collective works based on the Program.
|
128
|
+
|
129
|
+
In addition, mere aggregation of another work not based on the Program
|
130
|
+
with the Program (or with a work based on the Program) on a volume of
|
131
|
+
a storage or distribution medium does not bring the other work under
|
132
|
+
the scope of this License.
|
133
|
+
|
134
|
+
3. You may copy and distribute the Program (or a work based on it,
|
135
|
+
under Section 2) in object code or executable form under the terms of
|
136
|
+
Sections 1 and 2 above provided that you also do one of the following:
|
137
|
+
|
138
|
+
a) Accompany it with the complete corresponding machine-readable
|
139
|
+
source code, which must be distributed under the terms of Sections
|
140
|
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141
|
+
|
142
|
+
b) Accompany it with a written offer, valid for at least three
|
143
|
+
years, to give any third party, for a charge no more than your
|
144
|
+
cost of physically performing source distribution, a complete
|
145
|
+
machine-readable copy of the corresponding source code, to be
|
146
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147
|
+
customarily used for software interchange; or,
|
148
|
+
|
149
|
+
c) Accompany it with the information you received as to the offer
|
150
|
+
to distribute corresponding source code. (This alternative is
|
151
|
+
allowed only for noncommercial distribution and only if you
|
152
|
+
received the program in object code or executable form with such
|
153
|
+
an offer, in accord with Subsection b above.)
|
154
|
+
|
155
|
+
The source code for a work means the preferred form of the work for
|
156
|
+
making modifications to it. For an executable work, complete source
|
157
|
+
code means all the source code for all modules it contains, plus any
|
158
|
+
associated interface definition files, plus the scripts used to
|
159
|
+
control compilation and installation of the executable. However, as a
|
160
|
+
special exception, the source code distributed need not include
|
161
|
+
anything that is normally distributed (in either source or binary
|
162
|
+
form) with the major components (compiler, kernel, and so on) of the
|
163
|
+
operating system on which the executable runs, unless that component
|
164
|
+
itself accompanies the executable.
|
165
|
+
|
166
|
+
If distribution of executable or object code is made by offering
|
167
|
+
access to copy from a designated place, then offering equivalent
|
168
|
+
access to copy the source code from the same place counts as
|
169
|
+
distribution of the source code, even though third parties are not
|
170
|
+
compelled to copy the source along with the object code.
|
171
|
+
|
172
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173
|
+
except as expressly provided under this License. Any attempt
|
174
|
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175
|
+
void, and will automatically terminate your rights under this License.
|
176
|
+
However, parties who have received copies, or rights, from you under
|
177
|
+
this License will not have their licenses terminated so long as such
|
178
|
+
parties remain in full compliance.
|
179
|
+
|
180
|
+
5. You are not required to accept this License, since you have not
|
181
|
+
signed it. However, nothing else grants you permission to modify or
|
182
|
+
distribute the Program or its derivative works. These actions are
|
183
|
+
prohibited by law if you do not accept this License. Therefore, by
|
184
|
+
modifying or distributing the Program (or any work based on the
|
185
|
+
Program), you indicate your acceptance of this License to do so, and
|
186
|
+
all its terms and conditions for copying, distributing or modifying
|
187
|
+
the Program or works based on it.
|
188
|
+
|
189
|
+
6. Each time you redistribute the Program (or any work based on the
|
190
|
+
Program), the recipient automatically receives a license from the
|
191
|
+
original licensor to copy, distribute or modify the Program subject to
|
192
|
+
these terms and conditions. You may not impose any further
|
193
|
+
restrictions on the recipients' exercise of the rights granted herein.
|
194
|
+
You are not responsible for enforcing compliance by third parties to
|
195
|
+
this License.
|
196
|
+
|
197
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
198
|
+
infringement or for any other reason (not limited to patent issues),
|
199
|
+
conditions are imposed on you (whether by court order, agreement or
|
200
|
+
otherwise) that contradict the conditions of this License, they do not
|
201
|
+
excuse you from the conditions of this License. If you cannot
|
202
|
+
distribute so as to satisfy simultaneously your obligations under this
|
203
|
+
License and any other pertinent obligations, then as a consequence you
|
204
|
+
may not distribute the Program at all. For example, if a patent
|
205
|
+
license would not permit royalty-free redistribution of the Program by
|
206
|
+
all those who receive copies directly or indirectly through you, then
|
207
|
+
the only way you could satisfy both it and this License would be to
|
208
|
+
refrain entirely from distribution of the Program.
|
209
|
+
|
210
|
+
If any portion of this section is held invalid or unenforceable under
|
211
|
+
any particular circumstance, the balance of the section is intended to
|
212
|
+
apply and the section as a whole is intended to apply in other
|
213
|
+
circumstances.
|
214
|
+
|
215
|
+
It is not the purpose of this section to induce you to infringe any
|
216
|
+
patents or other property right claims or to contest validity of any
|
217
|
+
such claims; this section has the sole purpose of protecting the
|
218
|
+
integrity of the free software distribution system, which is
|
219
|
+
implemented by public license practices. Many people have made
|
220
|
+
generous contributions to the wide range of software distributed
|
221
|
+
through that system in reliance on consistent application of that
|
222
|
+
system; it is up to the author/donor to decide if he or she is willing
|
223
|
+
to distribute software through any other system and a licensee cannot
|
224
|
+
impose that choice.
|
225
|
+
|
226
|
+
This section is intended to make thoroughly clear what is believed to
|
227
|
+
be a consequence of the rest of this License.
|
228
|
+
|
229
|
+
8. If the distribution and/or use of the Program is restricted in
|
230
|
+
certain countries either by patents or by copyrighted interfaces, the
|
231
|
+
original copyright holder who places the Program under this License
|
232
|
+
may add an explicit geographical distribution limitation excluding
|
233
|
+
those countries, so that distribution is permitted only in or among
|
234
|
+
countries not thus excluded. In such case, this License incorporates
|
235
|
+
the limitation as if written in the body of this License.
|
236
|
+
|
237
|
+
9. The Free Software Foundation may publish revised and/or new versions
|
238
|
+
of the General Public License from time to time. Such new versions will
|
239
|
+
be similar in spirit to the present version, but may differ in detail to
|
240
|
+
address new problems or concerns.
|
241
|
+
|
242
|
+
Each version is given a distinguishing version number. If the Program
|
243
|
+
specifies a version number of this License which applies to it and "any
|
244
|
+
later version", you have the option of following the terms and conditions
|
245
|
+
either of that version or of any later version published by the Free
|
246
|
+
Software Foundation. If the Program does not specify a version number of
|
247
|
+
this License, you may choose any version ever published by the Free Software
|
248
|
+
Foundation.
|
249
|
+
|
250
|
+
10. If you wish to incorporate parts of the Program into other free
|
251
|
+
programs whose distribution conditions are different, write to the author
|
252
|
+
to ask for permission. For software which is copyrighted by the Free
|
253
|
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254
|
+
make exceptions for this. Our decision will be guided by the two goals
|
255
|
+
of preserving the free status of all derivatives of our free software and
|
256
|
+
of promoting the sharing and reuse of software generally.
|
257
|
+
|
258
|
+
NO WARRANTY
|
259
|
+
|
260
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261
|
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262
|
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263
|
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264
|
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266
|
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267
|
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268
|
+
REPAIR OR CORRECTION.
|
269
|
+
|
270
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271
|
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272
|
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273
|
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274
|
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275
|
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276
|
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277
|
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278
|
+
POSSIBILITY OF SUCH DAMAGES.
|
279
|
+
|
280
|
+
END OF TERMS AND CONDITIONS
|
data/LICENSE
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
= TinyMCE SplitBlockquote rails plugin
|
2
|
+
|
3
|
+
This gem use the tiny_mce gem's plugin system to install SplitBlockquote plugin.
|
4
|
+
|
5
|
+
For documentation on tiny_mce plugin, see the README at:
|
6
|
+
http://github.com/kete/tiny_mce/blob/master/README.rdoc
|
7
|
+
|
8
|
+
= Usage
|
9
|
+
|
10
|
+
To use this plugin, clone the source, submodule init, submodule update, gem build, gem install:
|
11
|
+
|
12
|
+
git clone http://github.com/Tauop/tinymce_splitblockquote.git
|
13
|
+
git submodule init
|
14
|
+
git submodule update
|
15
|
+
gem build tinymce_splitblockquote.gemspec
|
16
|
+
gem install tinymce_splitblockquote-0.0.1.gem
|
17
|
+
|
18
|
+
and add the following after the tiny_mce gem config line:
|
19
|
+
|
20
|
+
config.gem 'tiny_mce-plugin'
|
21
|
+
|
22
|
+
Alternatively, you can install it as a plugin. To do so, open a console, and in the root of you Rails application,
|
23
|
+
install the plugin by running one of the following (depending on the method you use to import plugins):
|
24
|
+
* script/plugin install git://github.com/Tauop/tinymce_splitblockquote.git
|
25
|
+
* piston import git://github.com/Tauop/tinymce_splitblockquote.git vendor/plugins/tinymce_splitblockquote
|
26
|
+
* git submodule add git://github.com/Tauop/tinymce_splitblockquote.git vendor/plugins/tinymce_splitblockquote
|
27
|
+
* Download the latest files ( http://github.com/Tauop/tinymce_splitblockquote/tarball/master ) and extract to vendor/plugins/tinymce_splitblockquote
|
28
|
+
|
29
|
+
|
30
|
+
= Credits
|
31
|
+
|
32
|
+
This gem was created by Patrick Guiran <pguiran@linagora.com>.
|
33
|
+
This gem depends on tinymce-splitblockquote-plugin project ( http://github.com/Tauop/tinymce_splitblockquote-plugin )
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "tinymce_splitblockquote"
|
8
|
+
gem.version = "0.0.3"
|
9
|
+
gem.summary = %Q{A tiny_mce gem's plugin installing my splitblockquote plugin.}
|
10
|
+
gem.description = %Q{This plugin splits (nested) blockquotes when the user try to break lines into them.}
|
11
|
+
|
12
|
+
gem.email = "pguiran@linagora.com"
|
13
|
+
gem.homepage = "http://github.com/Tauop/tinymce_splitblockquote"
|
14
|
+
gem.authors = ["Guiran Patrick"]
|
15
|
+
|
16
|
+
gem.files = Dir["lib/**/*", "[A-Z]*", "tinymce_splitblockquote.gemspec"]
|
17
|
+
gem.require_path = "lib"
|
18
|
+
|
19
|
+
gem.extra_rdoc_files = Dir["*.rdoc"]
|
20
|
+
gem.rdoc_options = ["--charset=UTF-8", "--exclude=lib/assets"]
|
21
|
+
|
22
|
+
gem.add_dependency('tiny_mce', '>= 0.1.4')
|
23
|
+
end
|
24
|
+
Jeweler::GemcutterTasks.new
|
25
|
+
rescue LoadError
|
26
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
27
|
+
end
|
data/lib/assets/COPYING
ADDED
@@ -0,0 +1,280 @@
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
2
|
+
Version 2, June 1991
|
3
|
+
|
4
|
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6
|
+
Everyone is permitted to copy and distribute verbatim copies
|
7
|
+
of this license document, but changing it is not allowed.
|
8
|
+
|
9
|
+
Preamble
|
10
|
+
|
11
|
+
The licenses for most software are designed to take away your
|
12
|
+
freedom to share and change it. By contrast, the GNU General Public
|
13
|
+
License is intended to guarantee your freedom to share and change free
|
14
|
+
software--to make sure the software is free for all its users. This
|
15
|
+
General Public License applies to most of the Free Software
|
16
|
+
Foundation's software and to any other program whose authors commit to
|
17
|
+
using it. (Some other Free Software Foundation software is covered by
|
18
|
+
the GNU Lesser General Public License instead.) You can apply it to
|
19
|
+
your programs, too.
|
20
|
+
|
21
|
+
When we speak of free software, we are referring to freedom, not
|
22
|
+
price. Our General Public Licenses are designed to make sure that you
|
23
|
+
have the freedom to distribute copies of free software (and charge for
|
24
|
+
this service if you wish), that you receive source code or can get it
|
25
|
+
if you want it, that you can change the software or use pieces of it
|
26
|
+
in new free programs; and that you know you can do these things.
|
27
|
+
|
28
|
+
To protect your rights, we need to make restrictions that forbid
|
29
|
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30
|
+
These restrictions translate to certain responsibilities for you if you
|
31
|
+
distribute copies of the software, or if you modify it.
|
32
|
+
|
33
|
+
For example, if you distribute copies of such a program, whether
|
34
|
+
gratis or for a fee, you must give the recipients all the rights that
|
35
|
+
you have. You must make sure that they, too, receive or can get the
|
36
|
+
source code. And you must show them these terms so they know their
|
37
|
+
rights.
|
38
|
+
|
39
|
+
We protect your rights with two steps: (1) copyright the software, and
|
40
|
+
(2) offer you this license which gives you legal permission to copy,
|
41
|
+
distribute and/or modify the software.
|
42
|
+
|
43
|
+
Also, for each author's protection and ours, we want to make certain
|
44
|
+
that everyone understands that there is no warranty for this free
|
45
|
+
software. If the software is modified by someone else and passed on, we
|
46
|
+
want its recipients to know that what they have is not the original, so
|
47
|
+
that any problems introduced by others will not reflect on the original
|
48
|
+
authors' reputations.
|
49
|
+
|
50
|
+
Finally, any free program is threatened constantly by software
|
51
|
+
patents. We wish to avoid the danger that redistributors of a free
|
52
|
+
program will individually obtain patent licenses, in effect making the
|
53
|
+
program proprietary. To prevent this, we have made it clear that any
|
54
|
+
patent must be licensed for everyone's free use or not licensed at all.
|
55
|
+
|
56
|
+
The precise terms and conditions for copying, distribution and
|
57
|
+
modification follow.
|
58
|
+
|
59
|
+
GNU GENERAL PUBLIC LICENSE
|
60
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61
|
+
|
62
|
+
0. This License applies to any program or other work which contains
|
63
|
+
a notice placed by the copyright holder saying it may be distributed
|
64
|
+
under the terms of this General Public License. The "Program", below,
|
65
|
+
refers to any such program or work, and a "work based on the Program"
|
66
|
+
means either the Program or any derivative work under copyright law:
|
67
|
+
that is to say, a work containing the Program or a portion of it,
|
68
|
+
either verbatim or with modifications and/or translated into another
|
69
|
+
language. (Hereinafter, translation is included without limitation in
|
70
|
+
the term "modification".) Each licensee is addressed as "you".
|
71
|
+
|
72
|
+
Activities other than copying, distribution and modification are not
|
73
|
+
covered by this License; they are outside its scope. The act of
|
74
|
+
running the Program is not restricted, and the output from the Program
|
75
|
+
is covered only if its contents constitute a work based on the
|
76
|
+
Program (independent of having been made by running the Program).
|
77
|
+
Whether that is true depends on what the Program does.
|
78
|
+
|
79
|
+
1. You may copy and distribute verbatim copies of the Program's
|
80
|
+
source code as you receive it, in any medium, provided that you
|
81
|
+
conspicuously and appropriately publish on each copy an appropriate
|
82
|
+
copyright notice and disclaimer of warranty; keep intact all the
|
83
|
+
notices that refer to this License and to the absence of any warranty;
|
84
|
+
and give any other recipients of the Program a copy of this License
|
85
|
+
along with the Program.
|
86
|
+
|
87
|
+
You may charge a fee for the physical act of transferring a copy, and
|
88
|
+
you may at your option offer warranty protection in exchange for a fee.
|
89
|
+
|
90
|
+
2. You may modify your copy or copies of the Program or any portion
|
91
|
+
of it, thus forming a work based on the Program, and copy and
|
92
|
+
distribute such modifications or work under the terms of Section 1
|
93
|
+
above, provided that you also meet all of these conditions:
|
94
|
+
|
95
|
+
a) You must cause the modified files to carry prominent notices
|
96
|
+
stating that you changed the files and the date of any change.
|
97
|
+
|
98
|
+
b) You must cause any work that you distribute or publish, that in
|
99
|
+
whole or in part contains or is derived from the Program or any
|
100
|
+
part thereof, to be licensed as a whole at no charge to all third
|
101
|
+
parties under the terms of this License.
|
102
|
+
|
103
|
+
c) If the modified program normally reads commands interactively
|
104
|
+
when run, you must cause it, when started running for such
|
105
|
+
interactive use in the most ordinary way, to print or display an
|
106
|
+
announcement including an appropriate copyright notice and a
|
107
|
+
notice that there is no warranty (or else, saying that you provide
|
108
|
+
a warranty) and that users may redistribute the program under
|
109
|
+
these conditions, and telling the user how to view a copy of this
|
110
|
+
License. (Exception: if the Program itself is interactive but
|
111
|
+
does not normally print such an announcement, your work based on
|
112
|
+
the Program is not required to print an announcement.)
|
113
|
+
|
114
|
+
These requirements apply to the modified work as a whole. If
|
115
|
+
identifiable sections of that work are not derived from the Program,
|
116
|
+
and can be reasonably considered independent and separate works in
|
117
|
+
themselves, then this License, and its terms, do not apply to those
|
118
|
+
sections when you distribute them as separate works. But when you
|
119
|
+
distribute the same sections as part of a whole which is a work based
|
120
|
+
on the Program, the distribution of the whole must be on the terms of
|
121
|
+
this License, whose permissions for other licensees extend to the
|
122
|
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123
|
+
|
124
|
+
Thus, it is not the intent of this section to claim rights or contest
|
125
|
+
your rights to work written entirely by you; rather, the intent is to
|
126
|
+
exercise the right to control the distribution of derivative or
|
127
|
+
collective works based on the Program.
|
128
|
+
|
129
|
+
In addition, mere aggregation of another work not based on the Program
|
130
|
+
with the Program (or with a work based on the Program) on a volume of
|
131
|
+
a storage or distribution medium does not bring the other work under
|
132
|
+
the scope of this License.
|
133
|
+
|
134
|
+
3. You may copy and distribute the Program (or a work based on it,
|
135
|
+
under Section 2) in object code or executable form under the terms of
|
136
|
+
Sections 1 and 2 above provided that you also do one of the following:
|
137
|
+
|
138
|
+
a) Accompany it with the complete corresponding machine-readable
|
139
|
+
source code, which must be distributed under the terms of Sections
|
140
|
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141
|
+
|
142
|
+
b) Accompany it with a written offer, valid for at least three
|
143
|
+
years, to give any third party, for a charge no more than your
|
144
|
+
cost of physically performing source distribution, a complete
|
145
|
+
machine-readable copy of the corresponding source code, to be
|
146
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147
|
+
customarily used for software interchange; or,
|
148
|
+
|
149
|
+
c) Accompany it with the information you received as to the offer
|
150
|
+
to distribute corresponding source code. (This alternative is
|
151
|
+
allowed only for noncommercial distribution and only if you
|
152
|
+
received the program in object code or executable form with such
|
153
|
+
an offer, in accord with Subsection b above.)
|
154
|
+
|
155
|
+
The source code for a work means the preferred form of the work for
|
156
|
+
making modifications to it. For an executable work, complete source
|
157
|
+
code means all the source code for all modules it contains, plus any
|
158
|
+
associated interface definition files, plus the scripts used to
|
159
|
+
control compilation and installation of the executable. However, as a
|
160
|
+
special exception, the source code distributed need not include
|
161
|
+
anything that is normally distributed (in either source or binary
|
162
|
+
form) with the major components (compiler, kernel, and so on) of the
|
163
|
+
operating system on which the executable runs, unless that component
|
164
|
+
itself accompanies the executable.
|
165
|
+
|
166
|
+
If distribution of executable or object code is made by offering
|
167
|
+
access to copy from a designated place, then offering equivalent
|
168
|
+
access to copy the source code from the same place counts as
|
169
|
+
distribution of the source code, even though third parties are not
|
170
|
+
compelled to copy the source along with the object code.
|
171
|
+
|
172
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173
|
+
except as expressly provided under this License. Any attempt
|
174
|
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175
|
+
void, and will automatically terminate your rights under this License.
|
176
|
+
However, parties who have received copies, or rights, from you under
|
177
|
+
this License will not have their licenses terminated so long as such
|
178
|
+
parties remain in full compliance.
|
179
|
+
|
180
|
+
5. You are not required to accept this License, since you have not
|
181
|
+
signed it. However, nothing else grants you permission to modify or
|
182
|
+
distribute the Program or its derivative works. These actions are
|
183
|
+
prohibited by law if you do not accept this License. Therefore, by
|
184
|
+
modifying or distributing the Program (or any work based on the
|
185
|
+
Program), you indicate your acceptance of this License to do so, and
|
186
|
+
all its terms and conditions for copying, distributing or modifying
|
187
|
+
the Program or works based on it.
|
188
|
+
|
189
|
+
6. Each time you redistribute the Program (or any work based on the
|
190
|
+
Program), the recipient automatically receives a license from the
|
191
|
+
original licensor to copy, distribute or modify the Program subject to
|
192
|
+
these terms and conditions. You may not impose any further
|
193
|
+
restrictions on the recipients' exercise of the rights granted herein.
|
194
|
+
You are not responsible for enforcing compliance by third parties to
|
195
|
+
this License.
|
196
|
+
|
197
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
198
|
+
infringement or for any other reason (not limited to patent issues),
|
199
|
+
conditions are imposed on you (whether by court order, agreement or
|
200
|
+
otherwise) that contradict the conditions of this License, they do not
|
201
|
+
excuse you from the conditions of this License. If you cannot
|
202
|
+
distribute so as to satisfy simultaneously your obligations under this
|
203
|
+
License and any other pertinent obligations, then as a consequence you
|
204
|
+
may not distribute the Program at all. For example, if a patent
|
205
|
+
license would not permit royalty-free redistribution of the Program by
|
206
|
+
all those who receive copies directly or indirectly through you, then
|
207
|
+
the only way you could satisfy both it and this License would be to
|
208
|
+
refrain entirely from distribution of the Program.
|
209
|
+
|
210
|
+
If any portion of this section is held invalid or unenforceable under
|
211
|
+
any particular circumstance, the balance of the section is intended to
|
212
|
+
apply and the section as a whole is intended to apply in other
|
213
|
+
circumstances.
|
214
|
+
|
215
|
+
It is not the purpose of this section to induce you to infringe any
|
216
|
+
patents or other property right claims or to contest validity of any
|
217
|
+
such claims; this section has the sole purpose of protecting the
|
218
|
+
integrity of the free software distribution system, which is
|
219
|
+
implemented by public license practices. Many people have made
|
220
|
+
generous contributions to the wide range of software distributed
|
221
|
+
through that system in reliance on consistent application of that
|
222
|
+
system; it is up to the author/donor to decide if he or she is willing
|
223
|
+
to distribute software through any other system and a licensee cannot
|
224
|
+
impose that choice.
|
225
|
+
|
226
|
+
This section is intended to make thoroughly clear what is believed to
|
227
|
+
be a consequence of the rest of this License.
|
228
|
+
|
229
|
+
8. If the distribution and/or use of the Program is restricted in
|
230
|
+
certain countries either by patents or by copyrighted interfaces, the
|
231
|
+
original copyright holder who places the Program under this License
|
232
|
+
may add an explicit geographical distribution limitation excluding
|
233
|
+
those countries, so that distribution is permitted only in or among
|
234
|
+
countries not thus excluded. In such case, this License incorporates
|
235
|
+
the limitation as if written in the body of this License.
|
236
|
+
|
237
|
+
9. The Free Software Foundation may publish revised and/or new versions
|
238
|
+
of the General Public License from time to time. Such new versions will
|
239
|
+
be similar in spirit to the present version, but may differ in detail to
|
240
|
+
address new problems or concerns.
|
241
|
+
|
242
|
+
Each version is given a distinguishing version number. If the Program
|
243
|
+
specifies a version number of this License which applies to it and "any
|
244
|
+
later version", you have the option of following the terms and conditions
|
245
|
+
either of that version or of any later version published by the Free
|
246
|
+
Software Foundation. If the Program does not specify a version number of
|
247
|
+
this License, you may choose any version ever published by the Free Software
|
248
|
+
Foundation.
|
249
|
+
|
250
|
+
10. If you wish to incorporate parts of the Program into other free
|
251
|
+
programs whose distribution conditions are different, write to the author
|
252
|
+
to ask for permission. For software which is copyrighted by the Free
|
253
|
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254
|
+
make exceptions for this. Our decision will be guided by the two goals
|
255
|
+
of preserving the free status of all derivatives of our free software and
|
256
|
+
of promoting the sharing and reuse of software generally.
|
257
|
+
|
258
|
+
NO WARRANTY
|
259
|
+
|
260
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261
|
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262
|
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263
|
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264
|
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266
|
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267
|
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268
|
+
REPAIR OR CORRECTION.
|
269
|
+
|
270
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271
|
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272
|
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273
|
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274
|
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275
|
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276
|
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277
|
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278
|
+
POSSIBILITY OF SUCH DAMAGES.
|
279
|
+
|
280
|
+
END OF TERMS AND CONDITIONS
|
data/lib/assets/LICENSE
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
Split Blockquote - TinyMCE plugin
|
2
|
+
=================================
|
3
|
+
|
4
|
+
What's Split Blockquote ?
|
5
|
+
-------------------------
|
6
|
+
|
7
|
+
This plugin aims to split blockquotes when the user try to break lines in teams.
|
8
|
+
In the example bellow, the user cursor is marked with the '|' caracter:
|
9
|
+
|
10
|
+
_________________________________________________________________________________________________
|
11
|
+
Before LineBreak insertion | After LineBreak insertion
|
12
|
+
_________________________________________________|_______________________________________________
|
13
|
+
<body> | <body>
|
14
|
+
<blockquote> | <blockquote>
|
15
|
+
This is a comment which has been quoted.| | This is a comment which has been quoted.
|
16
|
+
Try it :-) ! | </blockquote>
|
17
|
+
</blockquote> | <p>|</p>
|
18
|
+
</body> | <blockquote>
|
19
|
+
| Try it :-) !
|
20
|
+
| </blockquote>
|
21
|
+
| </body>
|
22
|
+
_________________________________________________|_______________________________________________
|
23
|
+
<body> | <body>
|
24
|
+
<blockquote> | <blockquote>
|
25
|
+
<blockquote> | <blockquote>
|
26
|
+
<blockquote> | <blockquote>
|
27
|
+
hi all, what's up ? | Hi all, what's up ?
|
28
|
+
</blockquote> | </blockquote>
|
29
|
+
<span style="color:blue;"> | <span style="color:blue;">
|
30
|
+
Just try to write examples.| | Just try to write examples.
|
31
|
+
And you ? What's up ? | </span>
|
32
|
+
</span> | </blockquote>
|
33
|
+
</blockquote> | </blockquote>
|
34
|
+
I'm going to split those blockquote :p | <p>|</p>
|
35
|
+
</blockquote> | <blockquote>
|
36
|
+
</body> | <blockquote>
|
37
|
+
| <span style="color:blue;">
|
38
|
+
| And you ? What's up ?
|
39
|
+
| </span>
|
40
|
+
| </blockquote>
|
41
|
+
| I'm going to split those blockquote :p
|
42
|
+
| </blockquote>
|
43
|
+
| </body>
|
44
|
+
_________________________________________________|_______________________________________________
|
45
|
+
|
46
|
+
How to install it ?
|
47
|
+
-------------------
|
48
|
+
|
49
|
+
* Copy the tiny_mce/plugins/splitblockquote/ directory into the tinyMCE plugins directory
|
50
|
+
* Add 'splitblockquote' into the 'plugins' options, when initialize tinyMCE
|
51
|
+
tinyMCE.init({
|
52
|
+
...
|
53
|
+
plugins : 'spliblockquote,...'
|
54
|
+
});
|
55
|
+
|
56
|
+
Credits
|
57
|
+
-------
|
58
|
+
|
59
|
+
This plugin was created by Patrick Guiran <pguiran@linagora.com>
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(){tinymce.create("tinymce.plugins.SplitBlockquote",{getInfo:function(){return{longname:"Split Blockquote",author:"pguiran@linagora.com",authorurl:"http://github.com/Tauop/tinymce_splitblockquote-plugin/",infourl:"http://www.linagora.com/",version:"0.1"}},init:function(a,b){a.onKeyPress.add(function(l,n){var d,g,c,q,k,f,p;if(n.keyCode!=13){return}function o(s,i){var e=null;while(s){if(s==i){break}if(s.nodeName==="BLOCKQUOTE"){e=s}s=s.parentNode}return e}function j(t,i){function s(r){if(r.nodeName==="FONT"&&l.settings.convert_fonts_to_spans){return"</span>"}else{return"</"+r.nodeName.toLowerCase()+">"}}var e="";while(t){if(t==i){break}e+=s(t);t=t.parentNode}return e}function h(t,s){function i(v){var r,u;u=v.cloneNode(false);u.innerHTML="";r=l.dom.getOuterHTML(u).replace(new RegExp("<"+u.nodeName,"i"),"").replace(new RegExp("</"+u.nodeName+">","i"),"");return"<"+u.nodeName.toLowerCase()+r}var e="";while(t){if(t==s){break}e=i(t)+e;t=t.parentNode}return e}c=l.selection.getNode();q=o(c,l.getBody());if(!q){return}p="_$"+(new Date()).getTime()+"$_";l.selection.setContent(p,{formar:"raw"});d=l.getContent().split(p);k=h(c,q);f=j(c,q);if(l.settings.convert_fonts_to_spans&&k!=""){(function(){var e=(k.match(/<font/ig)||[]).length;for(g=0;g<e;++g){start_idx=d[1].indexOf("</span>");if(start_idx!=-1){d[1]=d[1].substring(0,start_idx)+"</font>"+d[1].substring(start_idx+7)}}})()}l.setContent(d[0]+f+'</blockquote><br id="__"><blockquote>'+k+d[1]);function m(i){var e;if(i==null||i.nodeName!="P"){return}e=i.innerHTML.trim();if(e==""||e=='<br mce_bogus="1">'||e=="<br>"){l.dom.remove(i)}}q=l.getBody().getElementsByTagName("blockquote");for(g=0;g<q.length;++g){if(q[g]==null){continue}m(q[g].firstChild);m(q[g].lastChild);if(q[g].innerHTML.trim()===""){l.dom.remove(q[g])}}c=l.dom.get("__");c.removeAttribute("id");l.selection.select(c);l.selection.collapse(true);return tinymce.dom.Event.cancel(n)})}});tinymce.PluginManager.add("splitblockquote",tinymce.plugins.SplitBlockquote)})();
|
@@ -0,0 +1,213 @@
|
|
1
|
+
/**
|
2
|
+
* This plugin aims to split blockquotes when the user try to break lines in teams.
|
3
|
+
* In the example bellow, the user cursor is marked with the '|' caracter:
|
4
|
+
*
|
5
|
+
* _________________________________________________________________________________________________
|
6
|
+
* Before LineBreak insertion | After LineBreak insertion
|
7
|
+
* _________________________________________________|_______________________________________________
|
8
|
+
* <body> | <body>
|
9
|
+
* <blockquote> | <blockquote>
|
10
|
+
* This is a comment which has been quoted.| | This is a comment which has been quoted.
|
11
|
+
* Try it :-) ! | </blockquote>
|
12
|
+
* </blockquote> | <p>|</p>
|
13
|
+
* </body> | <blockquote>
|
14
|
+
* | Try it :-) !
|
15
|
+
* | </blockquote>
|
16
|
+
* | </body>
|
17
|
+
* _________________________________________________|_______________________________________________
|
18
|
+
* <body> | <body>
|
19
|
+
* <blockquote> | <blockquote>
|
20
|
+
* <blockquote> | <blockquote>
|
21
|
+
* <blockquote> | <blockquote>
|
22
|
+
* hi all, what's up ? | Hi all, what's up ?
|
23
|
+
* </blockquote> | </blockquote>
|
24
|
+
* <span style="color:blue;"> | <span style="color:blue;">
|
25
|
+
* Just try to write examples.| | Just try to write examples.
|
26
|
+
* And you ? What's up ? | </span>
|
27
|
+
* </span> | </blockquote>
|
28
|
+
* </blockquote> | </blockquote>
|
29
|
+
* I'm going to split those blockquote :p | <p>|</p>
|
30
|
+
* </blockquote> | <blockquote>
|
31
|
+
* </body> | <blockquote>
|
32
|
+
* | <span style="color:blue;">
|
33
|
+
* | And you ? What's up ?
|
34
|
+
* | </span>
|
35
|
+
* | </blockquote>
|
36
|
+
* | I'm going to split those blockquote :p
|
37
|
+
* | </blockquote>
|
38
|
+
* | </body>
|
39
|
+
* _________________________________________________|_______________________________________________
|
40
|
+
*
|
41
|
+
*
|
42
|
+
* @author Patrick Guiran <pguiran@linagora.com>
|
43
|
+
* @license GNU GENERAL PUBLIC LICENSE, Version 2
|
44
|
+
* @copyright Copyright © 2010, Linagora, Patrick Guiran <pguiran@linagora.com>
|
45
|
+
*/
|
46
|
+
|
47
|
+
(function() {
|
48
|
+
tinymce.create('tinymce.plugins.SplitBlockquote', {
|
49
|
+
getInfo : function() {
|
50
|
+
return {
|
51
|
+
longname : 'Split Blockquote',
|
52
|
+
author : 'pguiran@linagora.com',
|
53
|
+
authorurl : 'http://github.com/Tauop/tinymce_splitblockquote-plugin/',
|
54
|
+
infourl : 'http://www.linagora.com/',
|
55
|
+
version : '0.1'
|
56
|
+
};
|
57
|
+
},
|
58
|
+
|
59
|
+
init : function(ed, url) {
|
60
|
+
ed.onKeyPress.add(function(ed, e) {
|
61
|
+
var parts, i, node, bq_node, openTags, closeTags, splitToken;
|
62
|
+
|
63
|
+
if (e.keyCode != 13) {
|
64
|
+
return; /* do nothing */
|
65
|
+
}
|
66
|
+
|
67
|
+
// get the top-most blockquote parent node
|
68
|
+
function getMostTopBlockquote(n, r) {
|
69
|
+
var last_bq = null;
|
70
|
+
while (n) {
|
71
|
+
if (n == r)
|
72
|
+
break;
|
73
|
+
if (n.nodeName === 'BLOCKQUOTE')
|
74
|
+
last_bq = n;
|
75
|
+
n = n.parentNode;
|
76
|
+
}
|
77
|
+
return last_bq;
|
78
|
+
};
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
function getClose(n, r) {
|
83
|
+
// get the htnk "close-tag" of a node
|
84
|
+
function getCloseTag(n) {
|
85
|
+
if ( n.nodeName === 'FONT' && ed.settings.convert_fonts_to_spans) {
|
86
|
+
return "</span>";
|
87
|
+
} else {
|
88
|
+
return "</" + n.nodeName.toLowerCase() + ">";
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
var result = '';
|
93
|
+
while (n) {
|
94
|
+
if (n == r)
|
95
|
+
break;
|
96
|
+
result += getCloseTag(n);
|
97
|
+
n = n.parentNode;
|
98
|
+
}
|
99
|
+
return result;
|
100
|
+
}
|
101
|
+
|
102
|
+
function getOpen(n, r) {
|
103
|
+
// get the html "open-tag" of a node
|
104
|
+
function getOpenTag(n) {
|
105
|
+
var attr, copy;
|
106
|
+
copy = n.cloneNode(false);
|
107
|
+
copy.innerHTML = '';
|
108
|
+
attr = ed.dom.getOuterHTML( copy )
|
109
|
+
.replace(new RegExp( '<' + copy.nodeName, "i"), '')
|
110
|
+
.replace(new RegExp( '</' + copy.nodeName + '>', "i" ), '');
|
111
|
+
return '<' + copy.nodeName.toLowerCase() + attr;
|
112
|
+
};
|
113
|
+
|
114
|
+
var result = '';
|
115
|
+
while (n) {
|
116
|
+
if (n == r)
|
117
|
+
break;
|
118
|
+
result = getOpenTag(n) + result;
|
119
|
+
n = n.parentNode;
|
120
|
+
}
|
121
|
+
return result;
|
122
|
+
}
|
123
|
+
|
124
|
+
node = ed.selection.getNode();
|
125
|
+
bq_node = getMostTopBlockquote(node, ed.getBody());
|
126
|
+
if (!bq_node) // we aren't in a blockquote
|
127
|
+
return;
|
128
|
+
|
129
|
+
/* Create an unique splitToken */
|
130
|
+
splitToken = '_$'+ (new Date()).getTime() + '$_';
|
131
|
+
ed.selection.setContent(splitToken, {formar: 'raw'});
|
132
|
+
parts = ed.getContent().split(splitToken);
|
133
|
+
|
134
|
+
/* blockquote can handle DOM tree. So we have to close
|
135
|
+
* and open DOM element correctly, and not wildly split
|
136
|
+
* the editor content. Plus, openTags has to keep all
|
137
|
+
* attributes to keep makeup of DOM elements, we split.
|
138
|
+
*/
|
139
|
+
openTags = getOpen(node, bq_node);
|
140
|
+
closeTags = getClose(node, bq_node);
|
141
|
+
|
142
|
+
if (ed.settings.convert_fonts_to_spans && openTags != '') {
|
143
|
+
/* juste convert </span> to </font>
|
144
|
+
* if <font> are converted to <span>
|
145
|
+
* as n.nodeName returns "FONT" for <span> node :/
|
146
|
+
* @see tinymce.Editor.-_convertFonts() for more information
|
147
|
+
*/
|
148
|
+
(function() {
|
149
|
+
var font_count = ( openTags.match(/<font/ig) || [] ).length;
|
150
|
+
for (i=0; i<font_count; ++i) {
|
151
|
+
start_idx = parts[1].indexOf('</span>');
|
152
|
+
if (start_idx != -1) {
|
153
|
+
parts[1] = parts[1].substring(0, start_idx)
|
154
|
+
+ '</font>'
|
155
|
+
+ parts[1].substring(start_idx + 7);
|
156
|
+
}
|
157
|
+
}
|
158
|
+
})();
|
159
|
+
}
|
160
|
+
|
161
|
+
/* Update the editor content :
|
162
|
+
* - part[0] : content before the selection, before split
|
163
|
+
* - closeTags : </tag> to close correctly html tags
|
164
|
+
* - </blockquote> : close the blockquote
|
165
|
+
* - <br id='__' /> : <br /> are converted to "<p> </p>". The id
|
166
|
+
* is used to change the location of the selection (cursor)
|
167
|
+
* - <blockquote> : open the new blockquote
|
168
|
+
* - openTags : re-open splited DOM nodes correctly
|
169
|
+
* - part[1] : content after the selection, before split
|
170
|
+
*/
|
171
|
+
ed.setContent( parts[0] + closeTags
|
172
|
+
+ "</blockquote><br id=\"__\"><blockquote>"
|
173
|
+
+ openTags + parts[1] );
|
174
|
+
|
175
|
+
/* delete empty <p>aragraphe at the end of the first blockquote
|
176
|
+
* and at the beginnig at the second blockquote.
|
177
|
+
* Delete id attributes to */
|
178
|
+
function clean_node(node) {
|
179
|
+
var node_html;
|
180
|
+
if ( node == null || node.nodeName != 'P' ) {
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
node_html = node.innerHTML.trim();
|
184
|
+
if (node_html == '' || node_html == '<br mce_bogus="1">' || node_html == '<br>') {
|
185
|
+
ed.dom.remove(node);
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
bq_node = ed.getBody().getElementsByTagName('blockquote');
|
190
|
+
for ( i = 0; i < bq_node.length; ++i) {
|
191
|
+
if ( bq_node[i] == null ) { continue; } /* paranoiac mode */
|
192
|
+
clean_node( bq_node[i].firstChild );
|
193
|
+
clean_node( bq_node[i].lastChild );
|
194
|
+
if ( bq_node[i].innerHTML.trim() === '' ) {
|
195
|
+
ed.dom.remove( bq_node[i] );
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
/* get the <br id="__"> element and put cursor on it */
|
200
|
+
node = ed.dom.get('__');
|
201
|
+
node.removeAttribute('id');
|
202
|
+
ed.selection.select(node);
|
203
|
+
ed.selection.collapse(true);
|
204
|
+
|
205
|
+
/* Don't interpret <ENTER> again, to prevent a new "<p> </p>" to be added */
|
206
|
+
return tinymce.dom.Event.cancel(e);
|
207
|
+
});
|
208
|
+
}
|
209
|
+
});
|
210
|
+
|
211
|
+
// Register plugin
|
212
|
+
tinymce.PluginManager.add('splitblockquote', tinymce.plugins.SplitBlockquote);
|
213
|
+
})();
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2010 Linagora
|
3
|
+
# Patrick Guiran <pguiran@linagora.com>
|
4
|
+
#
|
5
|
+
# This file is part of tinymce_splitblockquote
|
6
|
+
#
|
7
|
+
# TinyMCE SplitBlockquote is free software, you can redistribute
|
8
|
+
# it and/or modify it under the terms of the GNU General Public
|
9
|
+
# License as published by the Free Software Foundation; either
|
10
|
+
# version 2 of the License, or (at your option) any later version.
|
11
|
+
#
|
12
|
+
# TinyMCE SplitBlockquote is distributed in the hope that it will
|
13
|
+
# be useful, but WITHOUT ANY WARRANTY; without even the implied
|
14
|
+
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
15
|
+
# See the GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'tiny_mce'
|
21
|
+
|
22
|
+
unless defined?(TinyMCE::Plugin)
|
23
|
+
# as tiny_mce 0.1.5 isn't released yet, and only tiny_mce 0.1.4
|
24
|
+
# is on rubygem, we defined the plugin system
|
25
|
+
module TinyMCE
|
26
|
+
# copied from http://github.com/kete/tiny_mce/commit/16ab9054888ea39eead897226d72b3eaf6c20578
|
27
|
+
class Plugin
|
28
|
+
cattr_accessor :assets_path
|
29
|
+
def self.install
|
30
|
+
return unless File.directory?(self.assets_path)
|
31
|
+
require 'fileutils'
|
32
|
+
puts "Installing #{self.name} plugin assets from #{self.assets_path}"
|
33
|
+
FileUtils.cp_r "#{self.assets_path}/.", File.join(Rails.root.to_s, 'public', 'javascripts', 'tiny_mce')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# inspired from http://github.com/kete/tiny_mce_plugin_example
|
40
|
+
TinyMCE.install_or_update_tinymce
|
41
|
+
|
42
|
+
class TinyMCESplitBlockquote < TinyMCE::Plugin
|
43
|
+
self.assets_path = File.join(File.dirname(__FILE__), 'assets/tiny_mce')
|
44
|
+
end
|
45
|
+
|
46
|
+
TinyMCESplitBlockquote.install
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{tinymce_splitblockquote}
|
8
|
+
s.version = "0.0.3"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Guiran Patrick"]
|
12
|
+
s.date = %q{2010-07-22}
|
13
|
+
s.description = %q{This plugin splits (nested) blockquotes when the user try to break lines into them.}
|
14
|
+
s.email = %q{pguiran@linagora.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"COPYING",
|
20
|
+
"LICENSE",
|
21
|
+
"README.rdoc",
|
22
|
+
"Rakefile",
|
23
|
+
"lib/assets/COPYING",
|
24
|
+
"lib/assets/LICENSE",
|
25
|
+
"lib/assets/README.md",
|
26
|
+
"lib/assets/tiny_mce/plugins/splitblockquote/editor_plugin.js",
|
27
|
+
"lib/assets/tiny_mce/plugins/splitblockquote/editor_plugin_src.js",
|
28
|
+
"lib/tinymce_splitblockquote.rb",
|
29
|
+
"tinymce_splitblockquote.gemspec"
|
30
|
+
]
|
31
|
+
s.homepage = %q{http://github.com/Tauop/tinymce_splitblockquote}
|
32
|
+
s.rdoc_options = ["--charset=UTF-8", "--exclude=lib/assets"]
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
s.rubygems_version = %q{1.3.7}
|
35
|
+
s.summary = %q{A tiny_mce gem's plugin installing my splitblockquote plugin.}
|
36
|
+
|
37
|
+
if s.respond_to? :specification_version then
|
38
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
39
|
+
s.specification_version = 3
|
40
|
+
|
41
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
|
+
s.add_runtime_dependency(%q<tiny_mce>, [">= 0.1.4"])
|
43
|
+
else
|
44
|
+
s.add_dependency(%q<tiny_mce>, [">= 0.1.4"])
|
45
|
+
end
|
46
|
+
else
|
47
|
+
s.add_dependency(%q<tiny_mce>, [">= 0.1.4"])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tinymce_splitblockquote
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Guiran Patrick
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-07-22 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: tiny_mce
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 19
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 1
|
33
|
+
- 4
|
34
|
+
version: 0.1.4
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
description: This plugin splits (nested) blockquotes when the user try to break lines into them.
|
38
|
+
email: pguiran@linagora.com
|
39
|
+
executables: []
|
40
|
+
|
41
|
+
extensions: []
|
42
|
+
|
43
|
+
extra_rdoc_files:
|
44
|
+
- README.rdoc
|
45
|
+
files:
|
46
|
+
- COPYING
|
47
|
+
- LICENSE
|
48
|
+
- README.rdoc
|
49
|
+
- Rakefile
|
50
|
+
- lib/assets/COPYING
|
51
|
+
- lib/assets/LICENSE
|
52
|
+
- lib/assets/README.md
|
53
|
+
- lib/assets/tiny_mce/plugins/splitblockquote/editor_plugin.js
|
54
|
+
- lib/assets/tiny_mce/plugins/splitblockquote/editor_plugin_src.js
|
55
|
+
- lib/tinymce_splitblockquote.rb
|
56
|
+
- tinymce_splitblockquote.gemspec
|
57
|
+
has_rdoc: true
|
58
|
+
homepage: http://github.com/Tauop/tinymce_splitblockquote
|
59
|
+
licenses: []
|
60
|
+
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options:
|
63
|
+
- --charset=UTF-8
|
64
|
+
- --exclude=lib/assets
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
hash: 3
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
version: "0"
|
85
|
+
requirements: []
|
86
|
+
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 1.3.7
|
89
|
+
signing_key:
|
90
|
+
specification_version: 3
|
91
|
+
summary: A tiny_mce gem's plugin installing my splitblockquote plugin.
|
92
|
+
test_files: []
|
93
|
+
|