godmin-redactor 0.1.3 → 0.1.4
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/godmin/redactor/version.rb +1 -1
- data/vendor/assets/javascripts/redactor.js +413 -96
- data/vendor/assets/stylesheets/redactor.css +14 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc9aa37f6e1cd37c6e518d2e65067f6ef9827921
|
4
|
+
data.tar.gz: b156ee408955cc6ca2d02ed387b1208eba9ce388
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1492aa70c8393c5f9a33bb54cbee6b46b50aaa5e5d1526b0b57dca6053b10acc4ca40ee58b72e3b13f2d2cac1347a0eaeb28e5ae53ca55e8299e2134ea09cd5a
|
7
|
+
data.tar.gz: fade5a57d94424e8360832aa560d9c88829aab23a38b8e1e38363c5e22691cff876f591136169afac74b09b4ba05e23c77c9f305af1b171f306cfe696fa13307
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
|
-
Redactor v10.0.
|
3
|
-
Updated:
|
2
|
+
Redactor v10.0.9
|
3
|
+
Updated: March 16, 2015
|
4
4
|
|
5
5
|
http://imperavi.com/redactor/
|
6
6
|
|
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
// Functionality
|
96
96
|
$.Redactor = Redactor;
|
97
|
-
$.Redactor.VERSION = '10.0.
|
97
|
+
$.Redactor.VERSION = '10.0.9';
|
98
98
|
$.Redactor.modules = ['alignment', 'autosave', 'block', 'buffer', 'build', 'button',
|
99
99
|
'caret', 'clean', 'code', 'core', 'dropdown', 'file', 'focus',
|
100
100
|
'image', 'indent', 'inline', 'insert', 'keydown', 'keyup',
|
@@ -135,6 +135,7 @@
|
|
135
135
|
autosaveName: false,
|
136
136
|
autosaveInterval: 60, // seconds
|
137
137
|
autosaveOnChange: false,
|
138
|
+
autosaveFields: false,
|
138
139
|
|
139
140
|
linkTooltip: true,
|
140
141
|
linkProtocol: 'http',
|
@@ -191,7 +192,7 @@
|
|
191
192
|
|
192
193
|
tabifier: true,
|
193
194
|
|
194
|
-
deniedTags: ['
|
195
|
+
deniedTags: ['script', 'style'],
|
195
196
|
allowedTags: false, // or array
|
196
197
|
|
197
198
|
removeComments: false,
|
@@ -323,7 +324,9 @@
|
|
323
324
|
underline: 'Underline',
|
324
325
|
alignment: 'Alignment',
|
325
326
|
filename: 'Name (optional)',
|
326
|
-
edit: 'Edit'
|
327
|
+
edit: 'Edit',
|
328
|
+
upload_label: 'Drop file here or '
|
329
|
+
|
327
330
|
}
|
328
331
|
}
|
329
332
|
};
|
@@ -371,6 +374,16 @@
|
|
371
374
|
// setup allowed and denied tags
|
372
375
|
this.tidy.setupAllowed();
|
373
376
|
|
377
|
+
// setup denied tags
|
378
|
+
if (this.opts.deniedTags !== false)
|
379
|
+
{
|
380
|
+
var tags = ['html', 'head', 'link', 'body', 'meta', 'applet'];
|
381
|
+
for (var i = 0; i < tags.length; i++)
|
382
|
+
{
|
383
|
+
this.opts.deniedTags.push(tags[i]);
|
384
|
+
}
|
385
|
+
}
|
386
|
+
|
374
387
|
// load lang
|
375
388
|
this.lang.load();
|
376
389
|
|
@@ -541,7 +554,8 @@
|
|
541
554
|
// data
|
542
555
|
var data = {};
|
543
556
|
data['name'] = this.autosave.name;
|
544
|
-
data[this.autosave.name] =
|
557
|
+
data[this.autosave.name] = this.autosave.source;
|
558
|
+
data = this.autosave.getHiddenFields(data);
|
545
559
|
|
546
560
|
// ajax
|
547
561
|
var jsxhr = $.ajax({
|
@@ -552,6 +566,23 @@
|
|
552
566
|
|
553
567
|
jsxhr.done(this.autosave.success);
|
554
568
|
},
|
569
|
+
getHiddenFields: function(data)
|
570
|
+
{
|
571
|
+
if (this.opts.autosaveFields === false || typeof this.opts.autosaveFields !== 'object')
|
572
|
+
{
|
573
|
+
return data;
|
574
|
+
}
|
575
|
+
|
576
|
+
$.each(this.opts.autosaveFields, $.proxy(function(k, v)
|
577
|
+
{
|
578
|
+
if (v !== null && v.toString().indexOf('#') === 0) v = $(v).val();
|
579
|
+
data[k] = v;
|
580
|
+
|
581
|
+
}, this));
|
582
|
+
|
583
|
+
return data;
|
584
|
+
|
585
|
+
},
|
555
586
|
success: function(data)
|
556
587
|
{
|
557
588
|
var json;
|
@@ -586,7 +617,7 @@
|
|
586
617
|
|
587
618
|
if (typeof this.formatting[name].data != 'undefined') type = 'data';
|
588
619
|
else if (typeof this.formatting[name].attr != 'undefined') type = 'attr';
|
589
|
-
else if (typeof this.formatting[name]
|
620
|
+
else if (typeof this.formatting[name]['class'] != 'undefined') type = 'class';
|
590
621
|
|
591
622
|
if (typeof this.formatting[name].clear != 'undefined')
|
592
623
|
{
|
@@ -701,6 +732,11 @@
|
|
701
732
|
this.block.toggle($(block));
|
702
733
|
}
|
703
734
|
|
735
|
+
if (typeof this.block.type == 'undefined' && typeof this.block.value == 'undefined')
|
736
|
+
{
|
737
|
+
$(block).removeAttr('class').removeAttr('style');
|
738
|
+
}
|
739
|
+
|
704
740
|
},
|
705
741
|
setMultiple: function(tag)
|
706
742
|
{
|
@@ -777,14 +813,20 @@
|
|
777
813
|
{
|
778
814
|
$.each(this.block.blocks, $.proxy(function(i,s)
|
779
815
|
{
|
816
|
+
var $formatted = false;
|
780
817
|
if (this.opts.linebreaks)
|
781
818
|
{
|
782
819
|
$(s).prepend('<br>').append('<br>');
|
783
|
-
this.utils.replaceWithContents(s);
|
820
|
+
$formatted = this.utils.replaceWithContents(s);
|
784
821
|
}
|
785
822
|
else
|
786
823
|
{
|
787
|
-
this.utils.replaceToTag(s, 'p');
|
824
|
+
$formatted = this.utils.replaceToTag(s, 'p');
|
825
|
+
}
|
826
|
+
|
827
|
+
if ($formatted && typeof this.block.type == 'undefined' && typeof this.block.value == 'undefined')
|
828
|
+
{
|
829
|
+
$formatted.removeAttr('class').removeAttr('style');
|
788
830
|
}
|
789
831
|
|
790
832
|
}, this));
|
@@ -831,6 +873,11 @@
|
|
831
873
|
if (this.block.isRemoveInline) this.utils.removeInlineTags($formatted);
|
832
874
|
if (tag == 'p' || this.block.headTag) $formatted.find('p').contents().unwrap();
|
833
875
|
|
876
|
+
if (typeof this.block.type == 'undefined' && typeof this.block.value == 'undefined')
|
877
|
+
{
|
878
|
+
$formatted.removeAttr('class').removeAttr('style');
|
879
|
+
}
|
880
|
+
|
834
881
|
|
835
882
|
}, this));
|
836
883
|
}
|
@@ -1422,7 +1469,7 @@
|
|
1422
1469
|
// dropdown
|
1423
1470
|
if (btnObject.dropdown)
|
1424
1471
|
{
|
1425
|
-
var $dropdown = $('<div class="redactor-dropdown redactor-dropdown-box-' + btnName + '" style="display: none;">');
|
1472
|
+
var $dropdown = $('<div class="redactor-dropdown redactor-dropdown-' + this.uuid + ' redactor-dropdown-box-' + btnName + '" style="display: none;">');
|
1426
1473
|
$button.data('dropdown', $dropdown);
|
1427
1474
|
this.dropdown.build(btnName, $dropdown, btnObject.dropdown);
|
1428
1475
|
}
|
@@ -1525,7 +1572,7 @@
|
|
1525
1572
|
},
|
1526
1573
|
setInactiveAll: function(key)
|
1527
1574
|
{
|
1528
|
-
if (typeof key
|
1575
|
+
if (typeof key === 'undefined')
|
1529
1576
|
{
|
1530
1577
|
this.$toolbar.find('a.re-icon').removeClass('redactor-act');
|
1531
1578
|
}
|
@@ -1572,7 +1619,7 @@
|
|
1572
1619
|
var key = $btn.attr('rel');
|
1573
1620
|
this.button.addCallback($btn, 'dropdown');
|
1574
1621
|
|
1575
|
-
var $dropdown = $('<div class="redactor-dropdown redactor-dropdown-box-' + key + '" style="display: none;">');
|
1622
|
+
var $dropdown = $('<div class="redactor-dropdown redactor-dropdown-' + this.uuid + ' redactor-dropdown-box-' + key + '" style="display: none;">');
|
1576
1623
|
$btn.data('dropdown', $dropdown);
|
1577
1624
|
|
1578
1625
|
// build dropdown
|
@@ -1596,6 +1643,7 @@
|
|
1596
1643
|
if (!this.opts.toolbar) return;
|
1597
1644
|
|
1598
1645
|
var btn = this.button.build(key, { title: title });
|
1646
|
+
btn.addClass('redactor-btn-image');
|
1599
1647
|
this.$toolbar.prepend($('<li>').append(btn));
|
1600
1648
|
|
1601
1649
|
return btn;
|
@@ -1605,6 +1653,7 @@
|
|
1605
1653
|
if (!this.opts.toolbar) return;
|
1606
1654
|
|
1607
1655
|
var btn = this.button.build(key, { title: title });
|
1656
|
+
btn.addClass('redactor-btn-image');
|
1608
1657
|
var $btn = this.button.get(afterkey);
|
1609
1658
|
|
1610
1659
|
if ($btn.length !== 0) $btn.parent().after($('<li>').append(btn));
|
@@ -1617,6 +1666,7 @@
|
|
1617
1666
|
if (!this.opts.toolbar) return;
|
1618
1667
|
|
1619
1668
|
var btn = this.button.build(key, { title: title });
|
1669
|
+
btn.addClass('redactor-btn-image');
|
1620
1670
|
var $btn = this.button.get(beforekey);
|
1621
1671
|
|
1622
1672
|
if ($btn.length !== 0) $btn.parent().before($('<li>').append(btn));
|
@@ -1840,9 +1890,9 @@
|
|
1840
1890
|
|
1841
1891
|
// replace dollar sign to entity
|
1842
1892
|
html = html.replace(/\$/g, '$');
|
1843
|
-
|
1844
|
-
|
1845
|
-
html = html.replace(
|
1893
|
+
|
1894
|
+
// replace special characters in links
|
1895
|
+
html = html.replace(/<a href="(.*?[^>]?)®(.*?[^>]?)">/gi, '<a href="$1®$2">');
|
1846
1896
|
|
1847
1897
|
if (this.opts.replaceDivs) html = this.clean.replaceDivs(html);
|
1848
1898
|
if (this.opts.linebreaks) html = this.clean.replaceParagraphsToBr(html);
|
@@ -1964,8 +2014,6 @@
|
|
1964
2014
|
html = $.trim(html);
|
1965
2015
|
|
1966
2016
|
html = html.replace(/\$/g, '$');
|
1967
|
-
html = html.replace(/‘/g, '\'');
|
1968
|
-
html = html.replace(/’/g, '\'');
|
1969
2017
|
|
1970
2018
|
// convert dirty spaces
|
1971
2019
|
html = html.replace(/<span class="s1">/gi, '<span>');
|
@@ -1989,6 +2037,8 @@
|
|
1989
2037
|
{
|
1990
2038
|
html = html.replace(/”/g, '"');
|
1991
2039
|
html = html.replace(/“/g, '"');
|
2040
|
+
html = html.replace(/‘/g, '\'');
|
2041
|
+
html = html.replace(/’/g, '\'');
|
1992
2042
|
|
1993
2043
|
return this.clean.getPreCode(html);
|
1994
2044
|
}
|
@@ -2055,6 +2105,7 @@
|
|
2055
2105
|
html = this.clean.onPasteRemoveSpans(html);
|
2056
2106
|
html = this.clean.onPasteRemoveEmpty(html);
|
2057
2107
|
|
2108
|
+
|
2058
2109
|
html = this.clean.convertInline(html);
|
2059
2110
|
|
2060
2111
|
return html;
|
@@ -2214,6 +2265,12 @@
|
|
2214
2265
|
options.deniedTags = this.opts.deniedTags;
|
2215
2266
|
}
|
2216
2267
|
|
2268
|
+
// allowed tags
|
2269
|
+
if (this.opts.allowedTags)
|
2270
|
+
{
|
2271
|
+
options.allowedTags = this.opts.allowedTags;
|
2272
|
+
}
|
2273
|
+
|
2217
2274
|
return this.tidy.load(html, options);
|
2218
2275
|
|
2219
2276
|
},
|
@@ -2281,27 +2338,56 @@
|
|
2281
2338
|
},
|
2282
2339
|
savePreCode: function(html)
|
2283
2340
|
{
|
2284
|
-
|
2341
|
+
html = this.clean.savePreFormatting(html);
|
2342
|
+
html = this.clean.saveCodeFormatting(html);
|
2343
|
+
|
2344
|
+
return html;
|
2345
|
+
},
|
2346
|
+
savePreFormatting: function(html)
|
2347
|
+
{
|
2348
|
+
var pre = html.match(/<pre(.*?)>([\w\W]*?)<\/pre>/gi);
|
2285
2349
|
if (pre !== null)
|
2286
2350
|
{
|
2287
2351
|
$.each(pre, $.proxy(function(i,s)
|
2288
2352
|
{
|
2289
|
-
var arr = s.match(/<
|
2353
|
+
var arr = s.match(/<pre(.*?)>([\w\W]*?)<\/pre>/i);
|
2290
2354
|
|
2291
|
-
arr[
|
2292
|
-
arr[
|
2355
|
+
arr[2] = arr[2].replace(/<br\s?\/?>/g, '\n');
|
2356
|
+
arr[2] = arr[2].replace(/ /g, ' ');
|
2293
2357
|
|
2294
2358
|
if (this.opts.preSpaces)
|
2295
2359
|
{
|
2296
|
-
arr[
|
2360
|
+
arr[2] = arr[2].replace(/\t/g, Array(this.opts.preSpaces + 1).join(' '));
|
2297
2361
|
}
|
2298
2362
|
|
2299
|
-
arr[
|
2363
|
+
arr[2] = this.clean.encodeEntities(arr[2]);
|
2300
2364
|
|
2301
2365
|
// $ fix
|
2302
|
-
arr[
|
2366
|
+
arr[2] = arr[2].replace(/\$/g, '$');
|
2303
2367
|
|
2304
|
-
html = html.replace(s, '<' + arr[1] +
|
2368
|
+
html = html.replace(s, '<pre' + arr[1] + '>' + arr[2] + '</pre>');
|
2369
|
+
|
2370
|
+
}, this));
|
2371
|
+
}
|
2372
|
+
|
2373
|
+
return html;
|
2374
|
+
},
|
2375
|
+
saveCodeFormatting: function(html)
|
2376
|
+
{
|
2377
|
+
var code = html.match(/<code(.*?[^>])>(.*?)<\/code>/gi);
|
2378
|
+
if (code !== null)
|
2379
|
+
{
|
2380
|
+
$.each(code, $.proxy(function(i,s)
|
2381
|
+
{
|
2382
|
+
var arr = s.match(/<code(.*?[^>])>(.*?)<\/code>/i);
|
2383
|
+
|
2384
|
+
arr[2] = arr[2].replace(/ /g, ' ');
|
2385
|
+
arr[2] = this.clean.encodeEntities(arr[2]);
|
2386
|
+
|
2387
|
+
// $ fix
|
2388
|
+
arr[2] = arr[2].replace(/\$/g, '$');
|
2389
|
+
|
2390
|
+
html = html.replace(s, '<code' + arr[1] + '>' + arr[2] + '</code>');
|
2305
2391
|
|
2306
2392
|
}, this));
|
2307
2393
|
}
|
@@ -2323,7 +2409,7 @@
|
|
2323
2409
|
html = this.clean.getTextFromHtml(html);
|
2324
2410
|
html = html.replace(/\n/g, '<br />');
|
2325
2411
|
|
2326
|
-
if (this.opts.paragraphize && typeof paragraphize == 'undefined')
|
2412
|
+
if (this.opts.paragraphize && typeof paragraphize == 'undefined' && !this.utils.browser('mozilla'))
|
2327
2413
|
{
|
2328
2414
|
html = this.paragraphize.load(html);
|
2329
2415
|
}
|
@@ -2417,17 +2503,20 @@
|
|
2417
2503
|
if (this.utils.browser('msie')) return html;
|
2418
2504
|
|
2419
2505
|
html = html.replace(new RegExp('<img(.*?[^>])>', 'gi'), '<img$1 data-verified="redactor">');
|
2420
|
-
html = html.replace(new RegExp('<span(.*?)>', 'gi'), '<span$1 data-verified="redactor">');
|
2506
|
+
html = html.replace(new RegExp('<span(.*?[^>])>', 'gi'), '<span$1 data-verified="redactor">');
|
2421
2507
|
|
2422
2508
|
var matches = html.match(new RegExp('<(span|img)(.*?)style="(.*?)"(.*?[^>])>', 'gi'));
|
2509
|
+
|
2423
2510
|
if (matches)
|
2424
2511
|
{
|
2425
2512
|
var len = matches.length;
|
2426
2513
|
for (var i = 0; i < len; i++)
|
2427
2514
|
{
|
2428
2515
|
try {
|
2516
|
+
|
2429
2517
|
var newTag = matches[i].replace(/style="(.*?)"/i, 'style="$1" rel="$1"');
|
2430
|
-
html = html.replace(
|
2518
|
+
html = html.replace(matches[i], newTag);
|
2519
|
+
|
2431
2520
|
}
|
2432
2521
|
catch (e) {}
|
2433
2522
|
}
|
@@ -2498,6 +2587,9 @@
|
|
2498
2587
|
html = html.replace(/<div(.*?)>([\w\W]*?)<\/div>/gi, '<p$1>$2</p>');
|
2499
2588
|
}
|
2500
2589
|
|
2590
|
+
html = html.replace(/<div(.*?[^>])>/gi, '');
|
2591
|
+
html = html.replace(/<\/div>/gi, '');
|
2592
|
+
|
2501
2593
|
return html;
|
2502
2594
|
},
|
2503
2595
|
replaceDivsToBr: function(html)
|
@@ -2540,6 +2632,8 @@
|
|
2540
2632
|
this.$editor.html(html);
|
2541
2633
|
this.code.sync();
|
2542
2634
|
|
2635
|
+
if (html !== '') this.placeholder.remove();
|
2636
|
+
|
2543
2637
|
setTimeout($.proxy(this.buffer.add, this), 15);
|
2544
2638
|
if (this.start === false) this.observe.load();
|
2545
2639
|
|
@@ -2664,6 +2758,7 @@
|
|
2664
2758
|
|
2665
2759
|
this.observe.load();
|
2666
2760
|
this.opts.visual = true;
|
2761
|
+
this.core.setCallback('visual', html);
|
2667
2762
|
},
|
2668
2763
|
textareaIndenting: function(e)
|
2669
2764
|
{
|
@@ -2733,12 +2828,30 @@
|
|
2733
2828
|
this.$element.off('.redactor').removeData('redactor');
|
2734
2829
|
this.$editor.off('.redactor');
|
2735
2830
|
|
2831
|
+
$(document).off('click.redactor-image-delete.' + this.uuid);
|
2832
|
+
$(document).off('click.redactor-image-resize-hide.' + this.uuid);
|
2833
|
+
$(document).off('touchstart.redactor.' + this.uuid + ' click.redactor.' + this.uuid);
|
2834
|
+
$("body").off('scroll.redactor.' + this.uuid);
|
2835
|
+
$(this.opts.toolbarFixedTarget).off('scroll.redactor.' + this.uuid);
|
2836
|
+
|
2736
2837
|
// common
|
2737
2838
|
this.$editor.removeClass('redactor-editor redactor-linebreaks redactor-placeholder');
|
2738
2839
|
this.$editor.removeAttr('contenteditable');
|
2739
2840
|
|
2740
2841
|
var html = this.code.get();
|
2741
2842
|
|
2843
|
+
// dropdowns off
|
2844
|
+
this.$toolbar.find('a').each(function()
|
2845
|
+
{
|
2846
|
+
var $el = $(this);
|
2847
|
+
if ($el.data('dropdown'))
|
2848
|
+
{
|
2849
|
+
$el.data('dropdown').remove();
|
2850
|
+
$el.data('dropdown', {});
|
2851
|
+
}
|
2852
|
+
});
|
2853
|
+
|
2854
|
+
|
2742
2855
|
if (this.build.isTextarea())
|
2743
2856
|
{
|
2744
2857
|
this.$box.after(this.$element);
|
@@ -2778,9 +2891,9 @@
|
|
2778
2891
|
$.each(this.opts.formattingAdd, $.proxy(function(i,s)
|
2779
2892
|
{
|
2780
2893
|
var name = s.tag;
|
2781
|
-
if (typeof s
|
2894
|
+
if (typeof s['class'] != 'undefined')
|
2782
2895
|
{
|
2783
|
-
name = name + '-' + s
|
2896
|
+
name = name + '-' + s['class'];
|
2784
2897
|
}
|
2785
2898
|
|
2786
2899
|
s.type = (this.utils.isBlockTag(s.tag)) ? 'block' : 'inline';
|
@@ -2791,7 +2904,7 @@
|
|
2791
2904
|
this.formatting[name] = {
|
2792
2905
|
tag: s.tag,
|
2793
2906
|
style: s.style,
|
2794
|
-
'class': s
|
2907
|
+
'class': s['class'],
|
2795
2908
|
attr: s.attr,
|
2796
2909
|
data: s.data,
|
2797
2910
|
clear: s.clear
|
@@ -2898,7 +3011,6 @@
|
|
2898
3011
|
$dropdown.css({ position: 'absolute', left: left, top: top }).show();
|
2899
3012
|
}
|
2900
3013
|
|
2901
|
-
|
2902
3014
|
this.core.setCallback('dropdownShown', { dropdown: $dropdown, key: key, button: $button });
|
2903
3015
|
}
|
2904
3016
|
|
@@ -2930,7 +3042,7 @@
|
|
2930
3042
|
this.$toolbar.find('a.dropact').removeClass('redactor-act').removeClass('dropact');
|
2931
3043
|
|
2932
3044
|
$(document.body).removeClass('body-redactor-hidden').css('margin-right', 0);
|
2933
|
-
$('.redactor-dropdown').hide();
|
3045
|
+
$('.redactor-dropdown-' + this.uuid).hide();
|
2934
3046
|
this.core.setCallback('dropdownHide');
|
2935
3047
|
},
|
2936
3048
|
hide: function (e)
|
@@ -3032,8 +3144,7 @@
|
|
3032
3144
|
|
3033
3145
|
if (first[0].tagName == 'UL' || first[0].tagName == 'OL')
|
3034
3146
|
{
|
3035
|
-
|
3036
|
-
var child = first.children().first();
|
3147
|
+
var child = first.find('li').first();
|
3037
3148
|
if (!this.utils.isBlock(child) && child.text() === '')
|
3038
3149
|
{
|
3039
3150
|
// empty inline tag in li
|
@@ -3060,6 +3171,8 @@
|
|
3060
3171
|
if (this.utils.browser('mozilla') || this.utils.browser('msie'))
|
3061
3172
|
{
|
3062
3173
|
var last = this.$editor.children().last();
|
3174
|
+
|
3175
|
+
this.$editor.focus();
|
3063
3176
|
this.caret.setEnd(last);
|
3064
3177
|
}
|
3065
3178
|
else
|
@@ -3241,7 +3354,7 @@
|
|
3241
3354
|
}
|
3242
3355
|
|
3243
3356
|
$image.on('mousedown', $.proxy(this.image.hideResize, this));
|
3244
|
-
$image.on('click touchstart', $.proxy(function(e)
|
3357
|
+
$image.on('click.redactor touchstart', $.proxy(function(e)
|
3245
3358
|
{
|
3246
3359
|
this.observe.image = $image;
|
3247
3360
|
|
@@ -3249,8 +3362,8 @@
|
|
3249
3362
|
|
3250
3363
|
this.image.resizer = this.image.loadEditableControls($image);
|
3251
3364
|
|
3252
|
-
$(document).on('click.redactor-image-resize-hide', $.proxy(this.image.hideResize, this));
|
3253
|
-
this.$editor.on('click.redactor-image-resize-hide', $.proxy(this.image.hideResize, this));
|
3365
|
+
$(document).on('click.redactor-image-resize-hide.' + this.uuid, $.proxy(this.image.hideResize, this));
|
3366
|
+
this.$editor.on('click.redactor-image-resize-hide.' + this.uuid, $.proxy(this.image.hideResize, this));
|
3254
3367
|
|
3255
3368
|
// resize
|
3256
3369
|
if (!this.opts.imageResizable) return;
|
@@ -3383,8 +3496,8 @@
|
|
3383
3496
|
return $(this).contents();
|
3384
3497
|
});
|
3385
3498
|
|
3386
|
-
$(document).off('click.redactor-image-resize-hide');
|
3387
|
-
this.$editor.off('click.redactor-image-resize-hide');
|
3499
|
+
$(document).off('click.redactor-image-resize-hide.' + this.uuid);
|
3500
|
+
this.$editor.off('click.redactor-image-resize-hide.' + this.uuid);
|
3388
3501
|
|
3389
3502
|
if (typeof this.image.resizeHandle !== 'undefined')
|
3390
3503
|
{
|
@@ -3714,7 +3827,7 @@
|
|
3714
3827
|
var type, value;
|
3715
3828
|
|
3716
3829
|
if (typeof this.formatting[name].style != 'undefined') type = 'style';
|
3717
|
-
else if (typeof this.formatting[name]
|
3830
|
+
else if (typeof this.formatting[name]['class'] != 'undefined') type = 'class';
|
3718
3831
|
|
3719
3832
|
if (type) value = this.formatting[name][type];
|
3720
3833
|
|
@@ -3738,7 +3851,11 @@
|
|
3738
3851
|
this.inline.value = value || false;
|
3739
3852
|
|
3740
3853
|
this.buffer.set();
|
3741
|
-
|
3854
|
+
|
3855
|
+
if (!this.utils.browser('msie'))
|
3856
|
+
{
|
3857
|
+
this.$editor.focus();
|
3858
|
+
}
|
3742
3859
|
|
3743
3860
|
this.selection.get();
|
3744
3861
|
|
@@ -3759,14 +3876,18 @@
|
|
3759
3876
|
// inline there is
|
3760
3877
|
if ($parent.length !== 0 && (this.inline.type != 'style' && $parent[0].tagName != 'SPAN'))
|
3761
3878
|
{
|
3762
|
-
this.caret.setAfter($parent[0]);
|
3763
|
-
|
3764
3879
|
// remove empty
|
3765
|
-
if (
|
3880
|
+
if (this.utils.isEmpty($parent.text()))
|
3766
3881
|
{
|
3882
|
+
this.caret.setAfter($parent[0]);
|
3883
|
+
|
3767
3884
|
$parent.remove();
|
3768
3885
|
this.code.sync();
|
3769
3886
|
}
|
3887
|
+
else if (this.utils.isEndOfElement($parent))
|
3888
|
+
{
|
3889
|
+
this.caret.setAfter($parent[0]);
|
3890
|
+
}
|
3770
3891
|
|
3771
3892
|
return;
|
3772
3893
|
}
|
@@ -4358,6 +4479,8 @@
|
|
4358
4479
|
}
|
4359
4480
|
|
4360
4481
|
this.range.insertNode(frag);
|
4482
|
+
this.range.collapse(false);
|
4483
|
+
this.selection.addRange();
|
4361
4484
|
}
|
4362
4485
|
};
|
4363
4486
|
},
|
@@ -4478,21 +4601,28 @@
|
|
4478
4601
|
current = this.selection.getCurrent();
|
4479
4602
|
$next = $(this.keydown.current).next();
|
4480
4603
|
|
4481
|
-
|
4604
|
+
|
4605
|
+
|
4606
|
+
if ($next.length !== 0 && $next[0].tagName == 'BR')
|
4607
|
+
{
|
4608
|
+
return this.keydown.insertBreakLine(e);
|
4609
|
+
}
|
4610
|
+
else if (current !== false && $(current).hasClass('redactor-invisible-space'))
|
4482
4611
|
{
|
4483
4612
|
this.caret.setAfter(current);
|
4484
4613
|
$(current).contents().unwrap();
|
4614
|
+
|
4485
4615
|
return this.keydown.insertDblBreakLine(e);
|
4486
4616
|
}
|
4487
4617
|
else
|
4488
4618
|
{
|
4489
|
-
if (
|
4619
|
+
if (this.utils.isEndOfEditor())
|
4490
4620
|
{
|
4491
4621
|
return this.keydown.insertDblBreakLine(e);
|
4492
4622
|
}
|
4493
|
-
else if (
|
4623
|
+
else if ($next.length === 0 && current === false && typeof $next.context != 'undefined')
|
4494
4624
|
{
|
4495
|
-
return this.keydown.
|
4625
|
+
return this.keydown.insertBreakLine(e);
|
4496
4626
|
}
|
4497
4627
|
|
4498
4628
|
return this.keydown.insertBreakLine(e);
|
@@ -4503,16 +4633,32 @@
|
|
4503
4633
|
setTimeout($.proxy(this.keydown.replaceDivToBreakLine, this), 1);
|
4504
4634
|
}
|
4505
4635
|
// paragraphs
|
4506
|
-
else if (!this.opts.linebreaks && this.keydown.block
|
4636
|
+
else if (!this.opts.linebreaks && this.keydown.block)
|
4507
4637
|
{
|
4508
|
-
|
4638
|
+
if (this.keydown.block.tagName !== 'LI')
|
4639
|
+
{
|
4640
|
+
setTimeout($.proxy(this.keydown.replaceDivToParagraph, this), 1);
|
4641
|
+
}
|
4642
|
+
else
|
4643
|
+
{
|
4644
|
+
current = this.selection.getCurrent();
|
4645
|
+
var $parent = $(current).closest('li');
|
4646
|
+
var $list = $parent.closest('ul,ol');
|
4647
|
+
|
4648
|
+
if ($parent.length !== 0 && this.utils.isEmpty($parent.html()) && $list.next().length === 0)
|
4649
|
+
{
|
4650
|
+
var node = $(this.opts.emptyHtml);
|
4651
|
+
$list.after(node);
|
4652
|
+
this.caret.setStart(node);
|
4653
|
+
|
4654
|
+
return false;
|
4655
|
+
}
|
4656
|
+
}
|
4509
4657
|
}
|
4510
4658
|
else if (!this.opts.linebreaks && !this.keydown.block)
|
4511
4659
|
{
|
4512
4660
|
return this.keydown.insertParagraph(e);
|
4513
4661
|
}
|
4514
|
-
|
4515
|
-
|
4516
4662
|
}
|
4517
4663
|
|
4518
4664
|
// Shift+Enter or Ctrl+Enter
|
@@ -4531,6 +4677,12 @@
|
|
4531
4677
|
// image delete and backspace
|
4532
4678
|
if (key === this.keyCode.BACKSPACE || key === this.keyCode.DELETE)
|
4533
4679
|
{
|
4680
|
+
if (this.utils.browser('mozilla') && this.keydown.current && this.keydown.current.tagName === 'TD')
|
4681
|
+
{
|
4682
|
+
e.preventDefault();
|
4683
|
+
return false;
|
4684
|
+
}
|
4685
|
+
|
4534
4686
|
var nodes = this.selection.getNodes();
|
4535
4687
|
if (nodes)
|
4536
4688
|
{
|
@@ -4843,24 +4995,52 @@
|
|
4843
4995
|
this.selection.get();
|
4844
4996
|
var br1 = document.createElement('br');
|
4845
4997
|
|
4846
|
-
this.
|
4998
|
+
if (this.utils.browser('msie'))
|
4999
|
+
{
|
5000
|
+
this.range.collapse(false);
|
5001
|
+
this.range.setEnd(this.range.endContainer, this.range.endOffset);
|
5002
|
+
}
|
5003
|
+
else
|
5004
|
+
{
|
5005
|
+
this.range.deleteContents();
|
5006
|
+
}
|
5007
|
+
|
4847
5008
|
this.range.insertNode(br1);
|
4848
5009
|
|
4849
5010
|
if (dbl === true)
|
4850
5011
|
{
|
5012
|
+
|
5013
|
+
var $next = $(br1).next();
|
5014
|
+
if ($next.length !== 0 && $next[0].tagName === 'BR' && this.utils.isEndOfEditor())
|
5015
|
+
{
|
5016
|
+
this.caret.setAfter(br1);
|
5017
|
+
this.code.sync();
|
5018
|
+
return false;
|
5019
|
+
}
|
5020
|
+
|
4851
5021
|
var br2 = document.createElement('br');
|
4852
5022
|
this.range.insertNode(br2);
|
4853
5023
|
this.caret.setAfter(br2);
|
4854
5024
|
}
|
4855
5025
|
else
|
4856
5026
|
{
|
4857
|
-
this.
|
5027
|
+
this.keydown.insertBreakLineProcessingAfter(br1);
|
4858
5028
|
}
|
4859
5029
|
|
4860
5030
|
this.code.sync();
|
4861
|
-
|
4862
5031
|
return false;
|
4863
5032
|
},
|
5033
|
+
insertBreakLineProcessingAfter: function(node)
|
5034
|
+
{
|
5035
|
+
var space = this.utils.createSpaceElement();
|
5036
|
+
$(node).after(space);
|
5037
|
+
this.selection.selectElement(space);
|
5038
|
+
|
5039
|
+
$(space).replaceWith(function()
|
5040
|
+
{
|
5041
|
+
return $(this).contents();
|
5042
|
+
});
|
5043
|
+
},
|
4864
5044
|
removeInvisibleSpace: function()
|
4865
5045
|
{
|
4866
5046
|
var $current = $(this.keydown.current);
|
@@ -4902,7 +5082,6 @@
|
|
4902
5082
|
this.keyup.parent = this.selection.getParent();
|
4903
5083
|
var $parent = this.utils.isRedactorParent($(this.keyup.parent).parent());
|
4904
5084
|
|
4905
|
-
|
4906
5085
|
// callback
|
4907
5086
|
var keyupStop = this.core.setCallback('keyup', e);
|
4908
5087
|
if (keyupStop === false)
|
@@ -5285,12 +5464,17 @@
|
|
5285
5464
|
document.execCommand('createLink', false, link);
|
5286
5465
|
|
5287
5466
|
$a = $(this.selection.getCurrent()).closest('a');
|
5467
|
+
if (this.utils.browser('mozilla'))
|
5468
|
+
{
|
5469
|
+
$a = $('a[_moz_dirty=""]');
|
5470
|
+
}
|
5288
5471
|
|
5289
5472
|
if (target !== '') $a.attr('target', target);
|
5290
|
-
$a.removeAttr('style');
|
5473
|
+
$a.removeAttr('style').removeAttr('_moz_dirty');
|
5291
5474
|
|
5292
|
-
if (this.link.text
|
5475
|
+
if (this.link.text !== '' || this.link.text != text)
|
5293
5476
|
{
|
5477
|
+
|
5294
5478
|
$a.text(text);
|
5295
5479
|
this.selection.selectElement($a);
|
5296
5480
|
}
|
@@ -5311,7 +5495,10 @@
|
|
5311
5495
|
},
|
5312
5496
|
unlink: function(e)
|
5313
5497
|
{
|
5314
|
-
if (typeof e != 'undefined' && e.preventDefault)
|
5498
|
+
if (typeof e != 'undefined' && e.preventDefault)
|
5499
|
+
{
|
5500
|
+
e.preventDefault();
|
5501
|
+
}
|
5315
5502
|
|
5316
5503
|
var nodes = this.selection.getNodes();
|
5317
5504
|
if (!nodes) return;
|
@@ -5321,11 +5508,8 @@
|
|
5321
5508
|
var len = nodes.length;
|
5322
5509
|
for (var i = 0; i < len; i++)
|
5323
5510
|
{
|
5324
|
-
|
5325
|
-
|
5326
|
-
var $node = $(nodes[i]);
|
5327
|
-
$node.replaceWith($node.contents());
|
5328
|
-
}
|
5511
|
+
var $node = $(nodes[i]).closest('a');
|
5512
|
+
$node.replaceWith($node.contents());
|
5329
5513
|
}
|
5330
5514
|
|
5331
5515
|
// hide link's tooltip
|
@@ -5333,6 +5517,28 @@
|
|
5333
5517
|
|
5334
5518
|
this.code.sync();
|
5335
5519
|
|
5520
|
+
},
|
5521
|
+
toggleClass: function(className)
|
5522
|
+
{
|
5523
|
+
this.link.setClass(className, 'toggleClass');
|
5524
|
+
},
|
5525
|
+
addClass: function(className)
|
5526
|
+
{
|
5527
|
+
this.link.setClass(className, 'addClass');
|
5528
|
+
},
|
5529
|
+
removeClass: function(className)
|
5530
|
+
{
|
5531
|
+
this.link.setClass(className, 'removeClass');
|
5532
|
+
},
|
5533
|
+
setClass: function(className, func)
|
5534
|
+
{
|
5535
|
+
var links = this.selection.getInlinesTags(['a']);
|
5536
|
+
if (links === false) return;
|
5537
|
+
|
5538
|
+
$.each(links, function()
|
5539
|
+
{
|
5540
|
+
$(this)[func](className);
|
5541
|
+
});
|
5336
5542
|
}
|
5337
5543
|
};
|
5338
5544
|
},
|
@@ -5859,7 +6065,14 @@
|
|
5859
6065
|
var current = this.selection.getCurrent();
|
5860
6066
|
var parent = this.selection.getParent();
|
5861
6067
|
|
5862
|
-
|
6068
|
+
if (e !== false)
|
6069
|
+
{
|
6070
|
+
this.button.setInactiveAll();
|
6071
|
+
}
|
6072
|
+
else
|
6073
|
+
{
|
6074
|
+
this.button.setInactiveAll(btnName);
|
6075
|
+
}
|
5863
6076
|
|
5864
6077
|
if (e === false && btnName !== 'html')
|
5865
6078
|
{
|
@@ -5911,7 +6124,7 @@
|
|
5911
6124
|
|
5912
6125
|
}, this));
|
5913
6126
|
|
5914
|
-
$(document).on('click.redactor-image-delete', $.proxy(function(e)
|
6127
|
+
$(document).on('click.redactor-image-delete.' + this.uuid, $.proxy(function(e)
|
5915
6128
|
{
|
5916
6129
|
this.observe.image = false;
|
5917
6130
|
if (e.target.tagName == 'IMG' && this.utils.isRedactorParent(e.target))
|
@@ -5926,9 +6139,9 @@
|
|
5926
6139
|
{
|
5927
6140
|
if (!this.opts.linkTooltip) return;
|
5928
6141
|
|
5929
|
-
this.$editor.find('a').on('touchstart click', $.proxy(this.observe.showTooltip, this));
|
5930
|
-
this.$editor.on('touchstart click.redactor', $.proxy(this.observe.closeTooltip, this));
|
5931
|
-
$(document).on('touchstart click.redactor', $.proxy(this.observe.closeTooltip, this));
|
6142
|
+
this.$editor.find('a').on('touchstart.redactor.' + this.uuid + ' click.redactor.' + this.uuid, $.proxy(this.observe.showTooltip, this));
|
6143
|
+
this.$editor.on('touchstart.redactor.' + this.uuid + ' click.redactor.' + this.uuid, $.proxy(this.observe.closeTooltip, this));
|
6144
|
+
$(document).on('touchstart.redactor.' + this.uuid + ' click.redactor.' + this.uuid, $.proxy(this.observe.closeTooltip, this));
|
5932
6145
|
},
|
5933
6146
|
getTooltipPosition: function($link)
|
5934
6147
|
{
|
@@ -6066,7 +6279,9 @@
|
|
6066
6279
|
{
|
6067
6280
|
$.each(this.paragraphize.safes, function(i,s)
|
6068
6281
|
{
|
6282
|
+
s = (typeof s !== 'undefined') ? s.replace(/\$/g, '$') : s;
|
6069
6283
|
html = html.replace('{replace' + i + '}', s);
|
6284
|
+
|
6070
6285
|
});
|
6071
6286
|
|
6072
6287
|
return html;
|
@@ -6134,7 +6349,11 @@
|
|
6134
6349
|
return {
|
6135
6350
|
init: function(e)
|
6136
6351
|
{
|
6137
|
-
if (!this.opts.cleanOnPaste)
|
6352
|
+
if (!this.opts.cleanOnPaste)
|
6353
|
+
{
|
6354
|
+
setTimeout($.proxy(this.code.sync, this), 1);
|
6355
|
+
return;
|
6356
|
+
}
|
6138
6357
|
|
6139
6358
|
this.rtePaste = true;
|
6140
6359
|
|
@@ -6170,7 +6389,15 @@
|
|
6170
6389
|
{
|
6171
6390
|
this.$pasteBox = $('<div>').html('').attr('contenteditable', 'true').css({ position: 'fixed', width: 0, top: 0, left: '-9999px' });
|
6172
6391
|
|
6173
|
-
this
|
6392
|
+
if (this.utils.browser('msie'))
|
6393
|
+
{
|
6394
|
+
this.$box.append(this.$pasteBox);
|
6395
|
+
}
|
6396
|
+
else
|
6397
|
+
{
|
6398
|
+
$('body').append(this.$pasteBox);
|
6399
|
+
}
|
6400
|
+
|
6174
6401
|
this.$pasteBox.focus();
|
6175
6402
|
},
|
6176
6403
|
insert: function(html)
|
@@ -6327,7 +6554,7 @@
|
|
6327
6554
|
|
6328
6555
|
return false;
|
6329
6556
|
},
|
6330
|
-
getInlines: function(nodes)
|
6557
|
+
getInlines: function(nodes, tags)
|
6331
6558
|
{
|
6332
6559
|
this.selection.get();
|
6333
6560
|
|
@@ -6337,9 +6564,18 @@
|
|
6337
6564
|
}
|
6338
6565
|
|
6339
6566
|
var inlines = [];
|
6340
|
-
nodes = (typeof nodes == 'undefined') ? this.selection.getNodes() : nodes;
|
6567
|
+
nodes = (typeof nodes == 'undefined' || nodes === false) ? this.selection.getNodes() : nodes;
|
6341
6568
|
var inlineTags = this.opts.inlineTags;
|
6342
6569
|
inlineTags.push('span');
|
6570
|
+
|
6571
|
+
if (typeof tags !== 'undefined')
|
6572
|
+
{
|
6573
|
+
for (var i = 0; i < tags.length; i++)
|
6574
|
+
{
|
6575
|
+
inlineTags.push(tags[i]);
|
6576
|
+
}
|
6577
|
+
}
|
6578
|
+
|
6343
6579
|
$.each(nodes, $.proxy(function(i,node)
|
6344
6580
|
{
|
6345
6581
|
if ($.inArray(node.tagName.toLowerCase(), inlineTags) != -1)
|
@@ -6351,6 +6587,28 @@
|
|
6351
6587
|
|
6352
6588
|
return (inlines.length === 0) ? false : inlines;
|
6353
6589
|
},
|
6590
|
+
getInlinesTags: function(tags)
|
6591
|
+
{
|
6592
|
+
this.selection.get();
|
6593
|
+
|
6594
|
+
if (this.range && this.range.collapsed)
|
6595
|
+
{
|
6596
|
+
return false;
|
6597
|
+
}
|
6598
|
+
|
6599
|
+
var inlines = [];
|
6600
|
+
var nodes = this.selection.getNodes();
|
6601
|
+
$.each(nodes, $.proxy(function(i,node)
|
6602
|
+
{
|
6603
|
+
if ($.inArray(node.tagName.toLowerCase(), tags) != -1)
|
6604
|
+
{
|
6605
|
+
inlines.push(node);
|
6606
|
+
}
|
6607
|
+
|
6608
|
+
}, this));
|
6609
|
+
|
6610
|
+
return (inlines.length === 0) ? false : inlines;
|
6611
|
+
},
|
6354
6612
|
getBlocks: function(nodes)
|
6355
6613
|
{
|
6356
6614
|
this.selection.get();
|
@@ -6567,7 +6825,12 @@
|
|
6567
6825
|
},
|
6568
6826
|
removeMarkers: function()
|
6569
6827
|
{
|
6570
|
-
this.$editor.find('span.redactor-selection-marker').
|
6828
|
+
this.$editor.find('span.redactor-selection-marker').each(function(i,s)
|
6829
|
+
{
|
6830
|
+
var text = $(s).text().replace(/[\u200B-\u200D\uFEFF]/g, '');
|
6831
|
+
if (text === '') $(s).remove();
|
6832
|
+
else $(s).replaceWith(function() { return $(this).contents(); });
|
6833
|
+
});
|
6571
6834
|
},
|
6572
6835
|
getText: function()
|
6573
6836
|
{
|
@@ -6593,6 +6856,34 @@
|
|
6593
6856
|
}
|
6594
6857
|
|
6595
6858
|
return this.clean.onSync(html);
|
6859
|
+
},
|
6860
|
+
replaceWithHtml: function(html)
|
6861
|
+
{
|
6862
|
+
html = this.selection.getMarkerAsHtml(1) + html + this.selection.getMarkerAsHtml(2);
|
6863
|
+
|
6864
|
+
this.selection.get();
|
6865
|
+
|
6866
|
+
if (window.getSelection && window.getSelection().getRangeAt)
|
6867
|
+
{
|
6868
|
+
this.range.deleteContents();
|
6869
|
+
var div = document.createElement("div");
|
6870
|
+
div.innerHTML = html;
|
6871
|
+
|
6872
|
+
var frag = document.createDocumentFragment(), child;
|
6873
|
+
while ((child = div.firstChild))
|
6874
|
+
{
|
6875
|
+
frag.appendChild(child);
|
6876
|
+
}
|
6877
|
+
|
6878
|
+
this.range.insertNode(frag);
|
6879
|
+
}
|
6880
|
+
else if (document.selection && document.selection.createRange)
|
6881
|
+
{
|
6882
|
+
this.range.pasteHTML(html);
|
6883
|
+
}
|
6884
|
+
|
6885
|
+
this.selection.restore();
|
6886
|
+
this.code.sync();
|
6596
6887
|
}
|
6597
6888
|
};
|
6598
6889
|
},
|
@@ -6710,7 +7001,7 @@
|
|
6710
7001
|
// clean setup
|
6711
7002
|
var ownLine = ['area', 'body', 'head', 'hr', 'i?frame', 'link', 'meta', 'noscript', 'style', 'script', 'table', 'tbody', 'thead', 'tfoot'];
|
6712
7003
|
var contOwnLine = ['li', 'dt', 'dt', 'h[1-6]', 'option', 'script'];
|
6713
|
-
var newLevel = ['blockquote', 'div', 'dl', 'fieldset', 'form', 'frameset', 'map', 'ol', '
|
7004
|
+
var newLevel = ['p', 'blockquote', 'div', 'dl', 'fieldset', 'form', 'frameset', 'map', 'ol', 'pre', 'select', 'td', 'th', 'tr', 'ul'];
|
6714
7005
|
|
6715
7006
|
this.tabifier.lineBefore = new RegExp('^<(/?' + ownLine.join('|/?' ) + '|' + contOwnLine.join('|') + ')[ >]');
|
6716
7007
|
this.tabifier.lineAfter = new RegExp('^<(br|/?' + ownLine.join('|/?' ) + '|/' + contOwnLine.join('|/') + ')[ >]');
|
@@ -6875,6 +7166,7 @@
|
|
6875
7166
|
placeTag: function (tag, out)
|
6876
7167
|
{
|
6877
7168
|
var nl = tag.match(this.tabifier.newLevel);
|
7169
|
+
|
6878
7170
|
if (tag.match(this.tabifier.lineBefore) || nl)
|
6879
7171
|
{
|
6880
7172
|
out = out.replace(/\s*$/, '');
|
@@ -6890,7 +7182,7 @@
|
|
6890
7182
|
if (tag.match(this.tabifier.lineAfter) || tag.match(this.tabifier.newLevel))
|
6891
7183
|
{
|
6892
7184
|
out = out.replace(/ *$/, '');
|
6893
|
-
out += '\n';
|
7185
|
+
//out += '\n';
|
6894
7186
|
}
|
6895
7187
|
|
6896
7188
|
return out;
|
@@ -7437,7 +7729,7 @@
|
|
7437
7729
|
if (!this.opts.toolbarFixed) return;
|
7438
7730
|
|
7439
7731
|
this.toolbar.observeScroll();
|
7440
|
-
$(this.opts.toolbarFixedTarget).on('scroll.redactor', $.proxy(this.toolbar.observeScroll, this));
|
7732
|
+
$(this.opts.toolbarFixedTarget).on('scroll.redactor.' + this.uuid, $.proxy(this.toolbar.observeScroll, this));
|
7441
7733
|
|
7442
7734
|
},
|
7443
7735
|
setOverflow: function()
|
@@ -7502,7 +7794,7 @@
|
|
7502
7794
|
{
|
7503
7795
|
var top = this.opts.toolbarFixedTopOffset + scrollTop - boxTop;
|
7504
7796
|
var left = 0;
|
7505
|
-
var end = boxTop + this.$box.height()
|
7797
|
+
var end = boxTop + this.$box.height() - 32;
|
7506
7798
|
var width = this.$box.innerWidth();
|
7507
7799
|
|
7508
7800
|
this.$toolbar.addClass('toolbar-fixed-box');
|
@@ -7529,6 +7821,7 @@
|
|
7529
7821
|
this.toolbar.unsetDropdownsFixed();
|
7530
7822
|
this.$toolbar.removeClass('toolbar-fixed-box');
|
7531
7823
|
|
7824
|
+
|
7532
7825
|
},
|
7533
7826
|
setDropdownsFixed: function()
|
7534
7827
|
{
|
@@ -7540,7 +7833,7 @@
|
|
7540
7833
|
position = 'absolute';
|
7541
7834
|
}
|
7542
7835
|
|
7543
|
-
$('.redactor-dropdown').each(function()
|
7836
|
+
$('.redactor-dropdown-' + this.uuid).each(function()
|
7544
7837
|
{
|
7545
7838
|
$(this).css({ position: position, top: top + 'px' });
|
7546
7839
|
});
|
@@ -7548,7 +7841,7 @@
|
|
7548
7841
|
unsetDropdownsFixed: function()
|
7549
7842
|
{
|
7550
7843
|
var top = (this.$toolbar.innerHeight() + this.$toolbar.offset().top);
|
7551
|
-
$('.redactor-dropdown').each(function()
|
7844
|
+
$('.redactor-dropdown-' + this.uuid).each(function()
|
7552
7845
|
{
|
7553
7846
|
$(this).css({ position: 'absolute', top: top + 'px' });
|
7554
7847
|
});
|
@@ -7566,7 +7859,7 @@
|
|
7566
7859
|
this.upload.$el = $(id);
|
7567
7860
|
this.upload.$droparea = $('<div id="redactor-droparea" />');
|
7568
7861
|
|
7569
|
-
this.upload.$placeholdler = $('<div id="redactor-droparea-placeholder" />').text('
|
7862
|
+
this.upload.$placeholdler = $('<div id="redactor-droparea-placeholder" />').text(this.lang.get('upload_label'));
|
7570
7863
|
this.upload.$input = $('<input type="file" name="file" />');
|
7571
7864
|
|
7572
7865
|
this.upload.$placeholdler.append(this.upload.$input);
|
@@ -7627,6 +7920,7 @@
|
|
7627
7920
|
}
|
7628
7921
|
|
7629
7922
|
this.progress.show();
|
7923
|
+
this.core.setCallback('uploadStart', e, formData);
|
7630
7924
|
this.upload.sendData(formData, e);
|
7631
7925
|
},
|
7632
7926
|
setConfig: function(file)
|
@@ -7914,6 +8208,7 @@
|
|
7914
8208
|
html = html.replace(/\s/g, '');
|
7915
8209
|
html = html.replace(/^<p>[^\W\w\D\d]*?<\/p>$/i, '');
|
7916
8210
|
html = html.replace(/<iframe(.*?[^>])>$/i, 'iframe');
|
8211
|
+
html = html.replace(/<source(.*?[^>])>$/i, 'source');
|
7917
8212
|
|
7918
8213
|
// remove empty tags
|
7919
8214
|
if (removeEmptyTags !== false)
|
@@ -7982,7 +8277,7 @@
|
|
7982
8277
|
|
7983
8278
|
$s.find('.redactor-invisible-space').removeAttr('style').removeAttr('class');
|
7984
8279
|
|
7985
|
-
if ($s.find('hr, br, img, iframe').length !== 0) return;
|
8280
|
+
if ($s.find('hr, br, img, iframe, source').length !== 0) return;
|
7986
8281
|
var text = $.trim($s.text());
|
7987
8282
|
if (this.utils.isEmpty(text, false))
|
7988
8283
|
{
|
@@ -7993,8 +8288,6 @@
|
|
7993
8288
|
// save and restore scroll
|
7994
8289
|
saveScroll: function()
|
7995
8290
|
{
|
7996
|
-
if (this.utils.isSelectAll()) return;
|
7997
|
-
|
7998
8291
|
this.saveEditorScroll = this.$editor.scrollTop();
|
7999
8292
|
this.saveBodyScroll = $(window).scrollTop();
|
8000
8293
|
|
@@ -8039,6 +8332,8 @@
|
|
8039
8332
|
|
8040
8333
|
return $(this).contents();
|
8041
8334
|
});
|
8335
|
+
|
8336
|
+
return $(node);
|
8042
8337
|
},
|
8043
8338
|
replaceToTag: function(node, tag, removeInlineTags)
|
8044
8339
|
{
|
@@ -8071,13 +8366,16 @@
|
|
8071
8366
|
|
8072
8367
|
return (offset === 0) ? true : false;
|
8073
8368
|
},
|
8074
|
-
isEndOfElement: function()
|
8369
|
+
isEndOfElement: function(element)
|
8075
8370
|
{
|
8076
|
-
|
8077
|
-
|
8371
|
+
if (typeof element == 'undefined')
|
8372
|
+
{
|
8373
|
+
var element = this.selection.getBlock();
|
8374
|
+
if (!element) return false;
|
8375
|
+
}
|
8078
8376
|
|
8079
|
-
var offset = this.caret.getOffsetOfElement(
|
8080
|
-
var text = $.trim($(
|
8377
|
+
var offset = this.caret.getOffsetOfElement(element);
|
8378
|
+
var text = $.trim($(element).text()).replace(/\n\r\n/g, '');
|
8081
8379
|
|
8082
8380
|
return (offset == text.length) ? true : false;
|
8083
8381
|
},
|
@@ -8086,7 +8384,7 @@
|
|
8086
8384
|
var block = this.$editor[0];
|
8087
8385
|
|
8088
8386
|
var offset = this.caret.getOffsetOfElement(block);
|
8089
|
-
var text = $.trim($(block).
|
8387
|
+
var text = $.trim($(block).html().replace(/(<([^>]+)>)/gi,''));
|
8090
8388
|
|
8091
8389
|
return (offset == text.length) ? true : false;
|
8092
8390
|
},
|
@@ -8209,7 +8507,7 @@
|
|
8209
8507
|
|
8210
8508
|
if (browser == 'safari') return (typeof match[3] != 'undefined') ? match[3] == 'safari' : false;
|
8211
8509
|
if (browser == 'version') return match[2];
|
8212
|
-
if (browser == 'webkit') return (match[1] == 'chrome' || match[1] == 'webkit');
|
8510
|
+
if (browser == 'webkit') return (match[1] == 'chrome' || match[1] == 'opr' || match[1] == 'webkit');
|
8213
8511
|
if (match[1] == 'rv') return browser == 'msie';
|
8214
8512
|
if (match[1] == 'opr') return browser == 'webkit';
|
8215
8513
|
|
@@ -8233,7 +8531,7 @@
|
|
8233
8531
|
var urlCheck = '((?:http[s]?:\\/\\/(?:www\\.)?|www\\.){1}(?:[0-9A-Za-z\\-%_]+\\.)+[a-zA-Z]{2,}(?::[0-9]+)?(?:(?:/[0-9A-Za-z\\-#\\.%\+_]*)+)?(?:\\?(?:[0-9A-Za-z\\-\\.%_]+(?:=[0-9A-Za-z\\-\\.%_\\+]*)?)?(?:&(?:[0-9A-Za-z\\-\\.%_]+(?:=[0-9A-Za-z\\-\\.%_\\+]*)?)?)*)?(?:#[0-9A-Za-z\\-\\.%_\\+=\\?&;]*)?)';
|
8234
8532
|
var regex = new RegExp(urlCheck, 'gi');
|
8235
8533
|
var rProtocol = /(https?|ftp):\/\//i;
|
8236
|
-
var urlImage =
|
8534
|
+
var urlImage = new RegExp('(?:([^:/?#]+):)?(?:\/\/([^/?#]*))?([^?#]*\\.(?:jpg|gif|png))(?:\\?([^#]*))?(?:#(.*))?', 'gi');
|
8237
8535
|
|
8238
8536
|
var childNodes = (this.$editor ? this.$editor[0] : this).childNodes, i = childNodes.length;
|
8239
8537
|
while (i--)
|
@@ -8265,7 +8563,8 @@
|
|
8265
8563
|
// image
|
8266
8564
|
if (convertImageLinks && html && html.match(urlImage))
|
8267
8565
|
{
|
8268
|
-
|
8566
|
+
var matches = html.match(urlImage);
|
8567
|
+
html = html.replace(urlImage, '<img src="' + matches + '" />');
|
8269
8568
|
|
8270
8569
|
$(n).after(html).remove();
|
8271
8570
|
return;
|
@@ -8277,7 +8576,6 @@
|
|
8277
8576
|
var matches = html.match(regex);
|
8278
8577
|
if (convertUrlLinks && html && matches)
|
8279
8578
|
{
|
8280
|
-
|
8281
8579
|
var len = matches.length;
|
8282
8580
|
for (var z = 0; z < len; z++)
|
8283
8581
|
{
|
@@ -8296,7 +8594,26 @@
|
|
8296
8594
|
if (text.length > linkSize) text = text.substring(0, linkSize) + '...';
|
8297
8595
|
text = text.replace(/$/g, '$').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
8298
8596
|
|
8597
|
+
// buffer
|
8598
|
+
var buffer = [];
|
8599
|
+
var links = html.match('<a(.*?)</a>');
|
8600
|
+
if (links !== null)
|
8601
|
+
{
|
8602
|
+
var len = links.length;
|
8603
|
+
for (i = 0; i < len; i++)
|
8604
|
+
{
|
8605
|
+
buffer[i] = links[i];
|
8606
|
+
html = html.replace(links[i], '{abuffer' + i + '}');
|
8607
|
+
}
|
8608
|
+
}
|
8609
|
+
|
8299
8610
|
html = html.replace(href, '<a href=\"' + addProtocol + $.trim(href) + '\">' + $.trim(text) + '</a>' + space);
|
8611
|
+
|
8612
|
+
// rebuffer
|
8613
|
+
$.each(buffer, function(i,s)
|
8614
|
+
{
|
8615
|
+
html = html.replace('{abuffer' + i + '}', s);
|
8616
|
+
});
|
8300
8617
|
}
|
8301
8618
|
|
8302
8619
|
$(n).after(html).remove();
|
@@ -8309,4 +8626,4 @@
|
|
8309
8626
|
}
|
8310
8627
|
};
|
8311
8628
|
|
8312
|
-
})(jQuery);
|
8629
|
+
})(jQuery);
|
@@ -38,29 +38,31 @@
|
|
38
38
|
.redactor-box textarea:focus {
|
39
39
|
outline: none;
|
40
40
|
}
|
41
|
-
/*
|
42
|
-
Z-index setup
|
43
|
-
*/
|
44
41
|
.redactor-editor,
|
45
42
|
.redactor-box {
|
46
43
|
background: #fff;
|
47
44
|
}
|
45
|
+
/*
|
46
|
+
Z-index setup
|
47
|
+
*/
|
48
48
|
.redactor-editor,
|
49
49
|
.redactor-box,
|
50
50
|
.redactor-box textarea {
|
51
|
-
z-index: auto
|
51
|
+
z-index: auto;
|
52
52
|
}
|
53
53
|
.redactor-box-fullscreen {
|
54
|
-
z-index:
|
54
|
+
z-index: 1051;
|
55
|
+
}
|
56
|
+
.redactor-toolbar {
|
57
|
+
z-index: 100;
|
55
58
|
}
|
56
|
-
.redactor-toolbar,
|
57
59
|
.redactor-dropdown {
|
58
|
-
z-index:
|
60
|
+
z-index: 1052;
|
59
61
|
}
|
60
62
|
#redactor-modal-overlay,
|
61
63
|
#redactor-modal-box,
|
62
64
|
#redactor-modal {
|
63
|
-
z-index:
|
65
|
+
z-index: 1053;
|
64
66
|
}
|
65
67
|
/*
|
66
68
|
Resize
|
@@ -111,6 +113,9 @@ body .redactor-box-fullscreen {
|
|
111
113
|
.redactor-editor:focus {
|
112
114
|
outline: none;
|
113
115
|
}
|
116
|
+
.toolbar-fixed-box + .redactor-editor {
|
117
|
+
padding-top: 32px !important;
|
118
|
+
}
|
114
119
|
/*
|
115
120
|
Placeholder
|
116
121
|
*/
|
@@ -650,7 +655,7 @@ body .redactor-box-fullscreen {
|
|
650
655
|
padding-left: 0;
|
651
656
|
list-style: none;
|
652
657
|
max-height: 250px;
|
653
|
-
overflow-x:
|
658
|
+
overflow-x: auto;
|
654
659
|
}
|
655
660
|
#redactor-modal #redactor-modal-list li {
|
656
661
|
border-bottom: 1px solid #ddd;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: godmin-redactor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Varvet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: godmin
|