wysihtml-rails 0.5.0.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +78 -0
- data/Rakefile +1 -0
- data/lib/wysihtml/rails.rb +9 -0
- data/lib/wysihtml/rails/version.rb +5 -0
- data/vendor/assets/javascripts/parser_rules/advanced.js +562 -0
- data/vendor/assets/javascripts/parser_rules/advanced_and_extended.js +684 -0
- data/vendor/assets/javascripts/parser_rules/advanced_unwrap.js +667 -0
- data/vendor/assets/javascripts/parser_rules/simple.js +32 -0
- data/vendor/assets/javascripts/wysihtml-toolbar.js +15054 -0
- data/vendor/assets/javascripts/wysihtml.js +14337 -0
- data/vendor/assets/stylesheets/wysihtml.css +133 -0
- data/wysihtml-rails.gemspec +25 -0
- metadata +101 -0
@@ -0,0 +1,684 @@
|
|
1
|
+
/**
|
2
|
+
* Full HTML5 compatibility rule set
|
3
|
+
* Loosened and extended ruleset. Allows more freedom on user side
|
4
|
+
* These rules define which tags and CSS classes are supported and which tags should be specially treated.
|
5
|
+
*/
|
6
|
+
|
7
|
+
var wysihtml5ParserRulesDefaults = {
|
8
|
+
"blockLevelEl": {
|
9
|
+
"keep_styles": {
|
10
|
+
"textAlign": /^((left)|(right)|(center)|(justify))$/i,
|
11
|
+
"float": 1
|
12
|
+
},
|
13
|
+
"add_style": {
|
14
|
+
"align": "align_text"
|
15
|
+
},
|
16
|
+
"check_attributes": {
|
17
|
+
"id": "any"
|
18
|
+
}
|
19
|
+
},
|
20
|
+
|
21
|
+
"makeDiv": {
|
22
|
+
"rename_tag": "div",
|
23
|
+
"one_of_type": {
|
24
|
+
"alignment_object": 1
|
25
|
+
},
|
26
|
+
"remove_action": "unwrap",
|
27
|
+
"keep_styles": {
|
28
|
+
"textAlign": 1,
|
29
|
+
"float": 1
|
30
|
+
},
|
31
|
+
"add_style": {
|
32
|
+
"align": "align_text"
|
33
|
+
},
|
34
|
+
"check_attributes": {
|
35
|
+
"id": "any"
|
36
|
+
}
|
37
|
+
}
|
38
|
+
};
|
39
|
+
|
40
|
+
var wysihtml5ParserRules = {
|
41
|
+
/**
|
42
|
+
* CSS Class white-list
|
43
|
+
* Following CSS classes won't be removed when parsed by the wysihtml5 HTML parser
|
44
|
+
* If all classes should pass "any" as classes value. Ex: "classes": "any"
|
45
|
+
*/
|
46
|
+
"classes": "any",
|
47
|
+
|
48
|
+
/* blacklist of classes is only available if classes is set to any */
|
49
|
+
"classes_blacklist": {
|
50
|
+
"Apple-interchange-newline": 1,
|
51
|
+
"MsoNormal": 1,
|
52
|
+
"MsoPlainText": 1
|
53
|
+
},
|
54
|
+
|
55
|
+
"type_definitions": {
|
56
|
+
|
57
|
+
"alignment_object": {
|
58
|
+
"classes": {
|
59
|
+
"wysiwyg-text-align-center": 1,
|
60
|
+
"wysiwyg-text-align-justify": 1,
|
61
|
+
"wysiwyg-text-align-left": 1,
|
62
|
+
"wysiwyg-text-align-right": 1,
|
63
|
+
"wysiwyg-float-left": 1,
|
64
|
+
"wysiwyg-float-right": 1
|
65
|
+
},
|
66
|
+
"styles": {
|
67
|
+
"float": ["left", "right"],
|
68
|
+
"text-align": ["left", "right", "center"]
|
69
|
+
}
|
70
|
+
},
|
71
|
+
|
72
|
+
"valid_image_src": {
|
73
|
+
"attrs": {
|
74
|
+
"src": /^[^data\:]/i
|
75
|
+
}
|
76
|
+
},
|
77
|
+
|
78
|
+
"text_color_object": {
|
79
|
+
"styles": {
|
80
|
+
"color": true,
|
81
|
+
"background-color": true
|
82
|
+
}
|
83
|
+
},
|
84
|
+
|
85
|
+
"text_fontsize_object": {
|
86
|
+
"styles": {
|
87
|
+
"font-size": true
|
88
|
+
}
|
89
|
+
},
|
90
|
+
|
91
|
+
"text_formatting_object": {
|
92
|
+
"classes": {
|
93
|
+
"wysiwyg-color-aqua": 1,
|
94
|
+
"wysiwyg-color-black": 1,
|
95
|
+
"wysiwyg-color-blue": 1,
|
96
|
+
"wysiwyg-color-fuchsia": 1,
|
97
|
+
"wysiwyg-color-gray": 1,
|
98
|
+
"wysiwyg-color-green": 1,
|
99
|
+
"wysiwyg-color-lime": 1,
|
100
|
+
"wysiwyg-color-maroon": 1,
|
101
|
+
"wysiwyg-color-navy": 1,
|
102
|
+
"wysiwyg-color-olive": 1,
|
103
|
+
"wysiwyg-color-purple": 1,
|
104
|
+
"wysiwyg-color-red": 1,
|
105
|
+
"wysiwyg-color-silver": 1,
|
106
|
+
"wysiwyg-color-teal": 1,
|
107
|
+
"wysiwyg-color-white": 1,
|
108
|
+
"wysiwyg-color-yellow": 1,
|
109
|
+
"wysiwyg-font-size-large": 1,
|
110
|
+
"wysiwyg-font-size-larger": 1,
|
111
|
+
"wysiwyg-font-size-medium": 1,
|
112
|
+
"wysiwyg-font-size-small": 1,
|
113
|
+
"wysiwyg-font-size-smaller": 1,
|
114
|
+
"wysiwyg-font-size-x-large": 1,
|
115
|
+
"wysiwyg-font-size-x-small": 1,
|
116
|
+
"wysiwyg-font-size-xx-large": 1,
|
117
|
+
"wysiwyg-font-size-xx-small": 1
|
118
|
+
}
|
119
|
+
}
|
120
|
+
},
|
121
|
+
|
122
|
+
"comments": 1, // if set allows comments to pass
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Tag list
|
126
|
+
*
|
127
|
+
* The following options are available:
|
128
|
+
*
|
129
|
+
* - add_class: converts and deletes the given HTML4 attribute (align, clear, ...) via the given method to a css class
|
130
|
+
* The following methods are implemented in wysihtml5.dom.parse:
|
131
|
+
* - align_text: converts align attribute values (right/left/center/justify) to their corresponding css class "wysiwyg-text-align-*")
|
132
|
+
* <p align="center">foo</p> ... becomes ... <p> class="wysiwyg-text-align-center">foo</p>
|
133
|
+
* - clear_br: converts clear attribute values left/right/all/both to their corresponding css class "wysiwyg-clear-*"
|
134
|
+
* <br clear="all"> ... becomes ... <br class="wysiwyg-clear-both">
|
135
|
+
* - align_img: converts align attribute values (right/left) on <img> to their corresponding css class "wysiwyg-float-*"
|
136
|
+
*
|
137
|
+
* - remove: removes the element and its content
|
138
|
+
*
|
139
|
+
* - unwrap removes element but leaves content
|
140
|
+
*
|
141
|
+
* - rename_tag: renames the element to the given tag
|
142
|
+
*
|
143
|
+
* - set_class: adds the given class to the element (note: make sure that the class is in the "classes" white list above)
|
144
|
+
*
|
145
|
+
* - set_attributes: sets/overrides the given attributes
|
146
|
+
*
|
147
|
+
* - check_attributes: checks the given HTML attribute via the given method
|
148
|
+
* - url: allows only valid urls (starting with http:// or https://)
|
149
|
+
* - src: allows something like "/foobar.jpg", "http://google.com", ...
|
150
|
+
* - href: allows something like "mailto:bert@foo.com", "http://google.com", "/foobar.jpg"
|
151
|
+
* - alt: strips unwanted characters. if the attribute is not set, then it gets set (to ensure valid and compatible HTML)
|
152
|
+
* - numbers: ensures that the attribute only contains numeric (integer) characters (no float values or units)
|
153
|
+
* - dimension: for with/height attributes where floating point numbrs and percentages are allowed
|
154
|
+
* - any: allows anything to pass
|
155
|
+
*/
|
156
|
+
"tags": {
|
157
|
+
"tr": {
|
158
|
+
"add_style": {
|
159
|
+
"align": "align_text"
|
160
|
+
},
|
161
|
+
"check_attributes": {
|
162
|
+
"id": "any"
|
163
|
+
}
|
164
|
+
},
|
165
|
+
"strike": {
|
166
|
+
"unwrap": 1
|
167
|
+
},
|
168
|
+
"form": {
|
169
|
+
"unwrap": 1
|
170
|
+
},
|
171
|
+
"rt": {
|
172
|
+
"rename_tag": "span"
|
173
|
+
},
|
174
|
+
"code": {},
|
175
|
+
"acronym": {
|
176
|
+
"rename_tag": "span"
|
177
|
+
},
|
178
|
+
"br": {
|
179
|
+
"add_class": {
|
180
|
+
"clear": "clear_br"
|
181
|
+
}
|
182
|
+
},
|
183
|
+
"details": {
|
184
|
+
"unwrap": 1
|
185
|
+
},
|
186
|
+
"h4": wysihtml5ParserRulesDefaults.blockLevelEl,
|
187
|
+
"em": {},
|
188
|
+
"title": {
|
189
|
+
"remove": 1
|
190
|
+
},
|
191
|
+
"multicol": {
|
192
|
+
"unwrap": 1
|
193
|
+
},
|
194
|
+
"figure": {
|
195
|
+
"unwrap": 1
|
196
|
+
},
|
197
|
+
"xmp": {
|
198
|
+
"unwrap": 1
|
199
|
+
},
|
200
|
+
"small": {
|
201
|
+
"rename_tag": "span",
|
202
|
+
"set_class": "wysiwyg-font-size-smaller"
|
203
|
+
},
|
204
|
+
"area": {
|
205
|
+
"remove": 1
|
206
|
+
},
|
207
|
+
"time": {
|
208
|
+
"unwrap": 1
|
209
|
+
},
|
210
|
+
"dir": {
|
211
|
+
"rename_tag": "ul"
|
212
|
+
},
|
213
|
+
"bdi": {
|
214
|
+
"unwrap": 1
|
215
|
+
},
|
216
|
+
"command": {
|
217
|
+
"unwrap": 1
|
218
|
+
},
|
219
|
+
"ul": {
|
220
|
+
"check_attributes": {
|
221
|
+
"id": "any"
|
222
|
+
}
|
223
|
+
},
|
224
|
+
"progress": {
|
225
|
+
"rename_tag": "span"
|
226
|
+
},
|
227
|
+
"dfn": {
|
228
|
+
"unwrap": 1
|
229
|
+
},
|
230
|
+
"iframe": {
|
231
|
+
"check_attributes": {
|
232
|
+
"src": "any",
|
233
|
+
"width": "any",
|
234
|
+
"height": "any",
|
235
|
+
"frameborder": "any",
|
236
|
+
"style": "any",
|
237
|
+
"id": "any"
|
238
|
+
}
|
239
|
+
},
|
240
|
+
"figcaption": {
|
241
|
+
"unwrap": 1
|
242
|
+
},
|
243
|
+
"a": {
|
244
|
+
"check_attributes": {
|
245
|
+
"href": "href", // if you compiled master manually then change this from 'url' to 'href'
|
246
|
+
"rel": "any",
|
247
|
+
"target": "any",
|
248
|
+
"id": "any"
|
249
|
+
}
|
250
|
+
},
|
251
|
+
"img": {
|
252
|
+
"one_of_type": {
|
253
|
+
"valid_image_src": 1
|
254
|
+
},
|
255
|
+
"check_attributes": {
|
256
|
+
"width": "dimension",
|
257
|
+
"alt": "alt",
|
258
|
+
"src": "src", // if you compiled master manually then change this from 'url' to 'src'
|
259
|
+
"height": "dimension",
|
260
|
+
"id": "any"
|
261
|
+
},
|
262
|
+
"add_class": {
|
263
|
+
"align": "align_img"
|
264
|
+
}
|
265
|
+
},
|
266
|
+
"rb": {
|
267
|
+
"unwrap": 1
|
268
|
+
},
|
269
|
+
"footer": wysihtml5ParserRulesDefaults.makeDiv,
|
270
|
+
"noframes": {
|
271
|
+
"remove": 1
|
272
|
+
},
|
273
|
+
"abbr": {
|
274
|
+
"unwrap": 1
|
275
|
+
},
|
276
|
+
"u": {},
|
277
|
+
"bgsound": {
|
278
|
+
"remove": 1
|
279
|
+
},
|
280
|
+
"sup": {
|
281
|
+
"unwrap": 1
|
282
|
+
},
|
283
|
+
"address": {
|
284
|
+
"unwrap": 1
|
285
|
+
},
|
286
|
+
"basefont": {
|
287
|
+
"remove": 1
|
288
|
+
},
|
289
|
+
"nav": {
|
290
|
+
"unwrap": 1
|
291
|
+
},
|
292
|
+
"h1": wysihtml5ParserRulesDefaults.blockLevelEl,
|
293
|
+
"head": {
|
294
|
+
"unwrap": 1
|
295
|
+
},
|
296
|
+
"tbody": wysihtml5ParserRulesDefaults.blockLevelEl,
|
297
|
+
"dd": {
|
298
|
+
"unwrap": 1
|
299
|
+
},
|
300
|
+
"s": {
|
301
|
+
"unwrap": 1
|
302
|
+
},
|
303
|
+
"li": {},
|
304
|
+
"td": {
|
305
|
+
"check_attributes": {
|
306
|
+
"rowspan": "numbers",
|
307
|
+
"colspan": "numbers",
|
308
|
+
"valign": "any",
|
309
|
+
"align": "any",
|
310
|
+
"id": "any",
|
311
|
+
"class": "any"
|
312
|
+
},
|
313
|
+
"keep_styles": {
|
314
|
+
"backgroundColor": 1,
|
315
|
+
"width": 1,
|
316
|
+
"height": 1
|
317
|
+
},
|
318
|
+
"add_style": {
|
319
|
+
"align": "align_text"
|
320
|
+
}
|
321
|
+
},
|
322
|
+
"object": {
|
323
|
+
"remove": 1
|
324
|
+
},
|
325
|
+
|
326
|
+
"div": {
|
327
|
+
"one_of_type": {
|
328
|
+
"alignment_object": 1
|
329
|
+
},
|
330
|
+
"remove_action": "unwrap",
|
331
|
+
"keep_styles": {
|
332
|
+
"textAlign": 1,
|
333
|
+
"float": 1
|
334
|
+
},
|
335
|
+
"add_style": {
|
336
|
+
"align": "align_text"
|
337
|
+
},
|
338
|
+
"check_attributes": {
|
339
|
+
"id": "any",
|
340
|
+
"contenteditable": "any"
|
341
|
+
}
|
342
|
+
},
|
343
|
+
|
344
|
+
"option": {
|
345
|
+
"remove":1
|
346
|
+
},
|
347
|
+
"select": {
|
348
|
+
"remove":1
|
349
|
+
},
|
350
|
+
"i": {},
|
351
|
+
"track": {
|
352
|
+
"remove": 1
|
353
|
+
},
|
354
|
+
"wbr": {
|
355
|
+
"remove": 1
|
356
|
+
},
|
357
|
+
"fieldset": {
|
358
|
+
"unwrap": 1
|
359
|
+
},
|
360
|
+
"big": {
|
361
|
+
"rename_tag": "span",
|
362
|
+
"set_class": "wysiwyg-font-size-larger"
|
363
|
+
},
|
364
|
+
"button": {
|
365
|
+
"unwrap": 1
|
366
|
+
},
|
367
|
+
"noscript": {
|
368
|
+
"remove": 1
|
369
|
+
},
|
370
|
+
"svg": {
|
371
|
+
"remove": 1
|
372
|
+
},
|
373
|
+
"input": {
|
374
|
+
"remove": 1
|
375
|
+
},
|
376
|
+
"table": {
|
377
|
+
"keep_styles": {
|
378
|
+
"width": 1,
|
379
|
+
"textAlign": 1,
|
380
|
+
"float": 1
|
381
|
+
},
|
382
|
+
"check_attributes": {
|
383
|
+
"id": "any"
|
384
|
+
}
|
385
|
+
},
|
386
|
+
"keygen": {
|
387
|
+
"remove": 1
|
388
|
+
},
|
389
|
+
"h5": wysihtml5ParserRulesDefaults.blockLevelEl,
|
390
|
+
"meta": {
|
391
|
+
"remove": 1
|
392
|
+
},
|
393
|
+
"map": {
|
394
|
+
"remove": 1
|
395
|
+
},
|
396
|
+
"isindex": {
|
397
|
+
"remove": 1
|
398
|
+
},
|
399
|
+
"mark": {
|
400
|
+
"unwrap": 1
|
401
|
+
},
|
402
|
+
"caption": wysihtml5ParserRulesDefaults.blockLevelEl,
|
403
|
+
"tfoot": wysihtml5ParserRulesDefaults.blockLevelEl,
|
404
|
+
"base": {
|
405
|
+
"remove": 1
|
406
|
+
},
|
407
|
+
"video": {
|
408
|
+
"remove": 1
|
409
|
+
},
|
410
|
+
"strong": {},
|
411
|
+
"canvas": {
|
412
|
+
"remove": 1
|
413
|
+
},
|
414
|
+
"output": {
|
415
|
+
"unwrap": 1
|
416
|
+
},
|
417
|
+
"marquee": {
|
418
|
+
"unwrap": 1
|
419
|
+
},
|
420
|
+
"b": {},
|
421
|
+
"q": {
|
422
|
+
"check_attributes": {
|
423
|
+
"cite": "url",
|
424
|
+
"id": "any"
|
425
|
+
}
|
426
|
+
},
|
427
|
+
"applet": {
|
428
|
+
"remove": 1
|
429
|
+
},
|
430
|
+
"span": {
|
431
|
+
"one_of_type": {
|
432
|
+
"text_formatting_object": 1,
|
433
|
+
"text_color_object": 1,
|
434
|
+
"text_fontsize_object": 1
|
435
|
+
},
|
436
|
+
"keep_styles": {
|
437
|
+
"color": 1,
|
438
|
+
"backgroundColor": 1,
|
439
|
+
"fontSize": 1
|
440
|
+
},
|
441
|
+
"remove_action": "unwrap",
|
442
|
+
"check_attributes": {
|
443
|
+
"id": "any"
|
444
|
+
}
|
445
|
+
},
|
446
|
+
"rp": {
|
447
|
+
"unwrap": 1
|
448
|
+
},
|
449
|
+
"spacer": {
|
450
|
+
"remove": 1
|
451
|
+
},
|
452
|
+
"source": {
|
453
|
+
"remove": 1
|
454
|
+
},
|
455
|
+
"aside": wysihtml5ParserRulesDefaults.makeDiv,
|
456
|
+
"frame": {
|
457
|
+
"remove": 1
|
458
|
+
},
|
459
|
+
"section": wysihtml5ParserRulesDefaults.makeDiv,
|
460
|
+
"body": {
|
461
|
+
"unwrap": 1
|
462
|
+
},
|
463
|
+
"ol": {},
|
464
|
+
"nobr": {
|
465
|
+
"unwrap": 1
|
466
|
+
},
|
467
|
+
"html": {
|
468
|
+
"unwrap": 1
|
469
|
+
},
|
470
|
+
"summary": {
|
471
|
+
"unwrap": 1
|
472
|
+
},
|
473
|
+
"var": {
|
474
|
+
"unwrap": 1
|
475
|
+
},
|
476
|
+
"del": {
|
477
|
+
"unwrap": 1
|
478
|
+
},
|
479
|
+
"blockquote": {
|
480
|
+
"keep_styles": {
|
481
|
+
"textAlign": 1,
|
482
|
+
"float": 1
|
483
|
+
},
|
484
|
+
"add_style": {
|
485
|
+
"align": "align_text"
|
486
|
+
},
|
487
|
+
"check_attributes": {
|
488
|
+
"cite": "url",
|
489
|
+
"id": "any"
|
490
|
+
}
|
491
|
+
},
|
492
|
+
"style": {
|
493
|
+
"check_attributes": {
|
494
|
+
"type": "any",
|
495
|
+
"src": "any",
|
496
|
+
"charset": "any"
|
497
|
+
}
|
498
|
+
},
|
499
|
+
"device": {
|
500
|
+
"remove": 1
|
501
|
+
},
|
502
|
+
"meter": {
|
503
|
+
"unwrap": 1
|
504
|
+
},
|
505
|
+
"h3": wysihtml5ParserRulesDefaults.blockLevelEl,
|
506
|
+
"textarea": {
|
507
|
+
"unwrap": 1
|
508
|
+
},
|
509
|
+
"embed": {
|
510
|
+
"remove": 1
|
511
|
+
},
|
512
|
+
"hgroup": {
|
513
|
+
"unwrap": 1
|
514
|
+
},
|
515
|
+
"font": {
|
516
|
+
"rename_tag": "span",
|
517
|
+
"add_class": {
|
518
|
+
"size": "size_font"
|
519
|
+
}
|
520
|
+
},
|
521
|
+
"tt": {
|
522
|
+
"unwrap": 1
|
523
|
+
},
|
524
|
+
"noembed": {
|
525
|
+
"remove": 1
|
526
|
+
},
|
527
|
+
"thead": {
|
528
|
+
"add_style": {
|
529
|
+
"align": "align_text"
|
530
|
+
},
|
531
|
+
"check_attributes": {
|
532
|
+
"id": "any"
|
533
|
+
}
|
534
|
+
},
|
535
|
+
"blink": {
|
536
|
+
"unwrap": 1
|
537
|
+
},
|
538
|
+
"plaintext": {
|
539
|
+
"unwrap": 1
|
540
|
+
},
|
541
|
+
"xml": {
|
542
|
+
"remove": 1
|
543
|
+
},
|
544
|
+
"h6": wysihtml5ParserRulesDefaults.blockLevelEl,
|
545
|
+
"param": {
|
546
|
+
"remove": 1
|
547
|
+
},
|
548
|
+
"th": {
|
549
|
+
"check_attributes": {
|
550
|
+
"rowspan": "numbers",
|
551
|
+
"colspan": "numbers",
|
552
|
+
"valign": "any",
|
553
|
+
"align": "any",
|
554
|
+
"id": "any"
|
555
|
+
},
|
556
|
+
"keep_styles": {
|
557
|
+
"backgroundColor": 1,
|
558
|
+
"width": 1,
|
559
|
+
"height": 1
|
560
|
+
},
|
561
|
+
"add_style": {
|
562
|
+
"align": "align_text"
|
563
|
+
}
|
564
|
+
},
|
565
|
+
"legend": {
|
566
|
+
"unwrap": 1
|
567
|
+
},
|
568
|
+
"hr": {},
|
569
|
+
"label": {
|
570
|
+
"unwrap": 1
|
571
|
+
},
|
572
|
+
"dl": {
|
573
|
+
"unwrap": 1
|
574
|
+
},
|
575
|
+
"kbd": {
|
576
|
+
"unwrap": 1
|
577
|
+
},
|
578
|
+
"listing": {
|
579
|
+
"unwrap": 1
|
580
|
+
},
|
581
|
+
"dt": {
|
582
|
+
"unwrap": 1
|
583
|
+
},
|
584
|
+
"nextid": {
|
585
|
+
"remove": 1
|
586
|
+
},
|
587
|
+
"pre": {},
|
588
|
+
"center": wysihtml5ParserRulesDefaults.makeDiv,
|
589
|
+
"audio": {
|
590
|
+
"remove": 1
|
591
|
+
},
|
592
|
+
"datalist": {
|
593
|
+
"unwrap": 1
|
594
|
+
},
|
595
|
+
"samp": {
|
596
|
+
"unwrap": 1
|
597
|
+
},
|
598
|
+
"col": {
|
599
|
+
"remove": 1
|
600
|
+
},
|
601
|
+
"article": wysihtml5ParserRulesDefaults.makeDiv,
|
602
|
+
"cite": {},
|
603
|
+
"link": {
|
604
|
+
"remove": 1
|
605
|
+
},
|
606
|
+
"script": {
|
607
|
+
"check_attributes": {
|
608
|
+
"type": "any",
|
609
|
+
"src": "any",
|
610
|
+
"charset": "any"
|
611
|
+
}
|
612
|
+
},
|
613
|
+
"bdo": {
|
614
|
+
"unwrap": 1
|
615
|
+
},
|
616
|
+
"menu": {
|
617
|
+
"rename_tag": "ul"
|
618
|
+
},
|
619
|
+
"colgroup": {
|
620
|
+
"remove": 1
|
621
|
+
},
|
622
|
+
"ruby": {
|
623
|
+
"unwrap": 1
|
624
|
+
},
|
625
|
+
"h2": wysihtml5ParserRulesDefaults.blockLevelEl,
|
626
|
+
"ins": {
|
627
|
+
"unwrap": 1
|
628
|
+
},
|
629
|
+
"p": wysihtml5ParserRulesDefaults.blockLevelEl,
|
630
|
+
"sub": {
|
631
|
+
"unwrap": 1
|
632
|
+
},
|
633
|
+
"comment": {
|
634
|
+
"remove": 1
|
635
|
+
},
|
636
|
+
"frameset": {
|
637
|
+
"remove": 1
|
638
|
+
},
|
639
|
+
"optgroup": {
|
640
|
+
"unwrap": 1
|
641
|
+
},
|
642
|
+
"header": wysihtml5ParserRulesDefaults.makeDiv
|
643
|
+
}
|
644
|
+
};
|
645
|
+
|
646
|
+
|
647
|
+
(function() {
|
648
|
+
// Paste cleanup rules universal for all rules (also applied to content copied from editor)
|
649
|
+
var commonRules = wysihtml5.lang.object(wysihtml5ParserRules).clone(true);
|
650
|
+
commonRules.comments = false;
|
651
|
+
commonRules.selectors = { "a u": "unwrap"};
|
652
|
+
commonRules.tags.style = { "remove": 1 };
|
653
|
+
commonRules.tags.script = { "remove": 1 };
|
654
|
+
commonRules.tags.head = { "remove": 1 };
|
655
|
+
|
656
|
+
// Paste cleanup for unindentified source
|
657
|
+
var universalRules = wysihtml5.lang.object(commonRules).clone(true);
|
658
|
+
universalRules.tags.div.one_of_type.alignment_object = 1;
|
659
|
+
universalRules.tags.div.remove_action = "unwrap";
|
660
|
+
universalRules.tags.div.check_attributes.style = false;
|
661
|
+
universalRules.tags.div.keep_styles = {
|
662
|
+
"textAlign": /^((left)|(right)|(center)|(justify))$/i,
|
663
|
+
"float": 1
|
664
|
+
};
|
665
|
+
universalRules.tags.span.keep_styles = false;
|
666
|
+
|
667
|
+
// Paste cleanup for MS Office
|
668
|
+
// TODO: should be extended to stricter ruleset, as current set will probably not cover all Office bizarreness
|
669
|
+
var msOfficeRules = wysihtml5.lang.object(universalRules).clone(true);
|
670
|
+
msOfficeRules.classes = {};
|
671
|
+
|
672
|
+
window.wysihtml5ParserPasteRulesets = [
|
673
|
+
{
|
674
|
+
condition: /<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument|class="OutlineElement|id="?docs\-internal\-guid\-/i,
|
675
|
+
set: msOfficeRules
|
676
|
+
},{
|
677
|
+
condition: /<meta name="copied-from" content="wysihtml5">/i,
|
678
|
+
set: commonRules
|
679
|
+
},{
|
680
|
+
set: universalRules
|
681
|
+
}
|
682
|
+
];
|
683
|
+
|
684
|
+
})();
|