scratch – Diff between revs 58 and 125
?pathlinks?
Rev 58 | Rev 125 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | /** |
1 | /** |
|
2 | * Trumbowyg v2.5.1 - A lightweight WYSIWYG editor |
2 | * Trumbowyg v2.6.0 - A lightweight WYSIWYG editor |
|
3 | * Trumbowyg core file |
3 | * Trumbowyg core file |
|
4 | * ------------------------ |
4 | * ------------------------ |
|
5 | * @link http://alex-d.github.io/Trumbowyg |
5 | * @link http://alex-d.github.io/Trumbowyg |
|
6 | * @license MIT |
6 | * @license MIT |
|
7 | * @author Alexandre Demode (Alex-D) |
7 | * @author Alexandre Demode (Alex-D) |
|
Line 192... | Line 192... | |||
192 | $.ajax({ |
192 | $.ajax({ |
|
193 | async: true, |
193 | async: true, |
|
194 | type: 'GET', |
194 | type: 'GET', |
|
195 | contentType: 'application/x-www-form-urlencoded; charset=UTF-8', |
195 | contentType: 'application/x-www-form-urlencoded; charset=UTF-8', |
|
196 | dataType: 'xml', |
196 | dataType: 'xml', |
|
- | 197 | crossDomain : true, |
||
197 | url: svgPathOption, |
198 | url: svgPathOption, |
|
198 | data: null, |
199 | data: null, |
|
199 | beforeSend: null, |
200 | beforeSend: null, |
|
200 | complete: null, |
201 | complete: null, |
|
201 | success: function (data) { |
202 | success: function (data) { |
|
Line 1022... | Line 1023... | |||
1022 | syncCode: function (force) { |
1023 | syncCode: function (force) { |
|
1023 | var t = this; |
1024 | var t = this; |
|
1024 | if (!force && t.$ed.is(':visible')) { |
1025 | if (!force && t.$ed.is(':visible')) { |
|
1025 | t.syncTextarea(); |
1026 | t.syncTextarea(); |
|
1026 | } else { |
1027 | } else { |
|
- | 1028 | // wrap the content in a div it's easier to get the innerhtml |
||
- | 1029 | var html = '<div>' + t.$ta.val() + '</div>'; |
||
- | 1030 | //scrub the html before loading into the doc |
||
- | 1031 | html = $(t.o.tagsToRemove.join(','), html).remove().end().html(); |
||
1027 | t.$ed.html(t.$ta.val()); |
1032 | t.$ed.html(html); |
|
1028 | } |
1033 | } |
|
Line 1029... | Line 1034... | |||
1029 | |
1034 | |
|
1030 | if (t.o.autogrow) { |
1035 | if (t.o.autogrow) { |
|
1031 | t.height = t.$ed.height(); |
1036 | t.height = t.$ed.height(); |
|
Line 1043... | Line 1048... | |||
1043 | semanticCode: function (force, full, keepRange) { |
1048 | semanticCode: function (force, full, keepRange) { |
|
1044 | var t = this; |
1049 | var t = this; |
|
1045 | t.saveRange(); |
1050 | t.saveRange(); |
|
1046 | t.syncCode(force); |
1051 | t.syncCode(force); |
|
Line 1047... | Line -... | |||
1047 | |
- | ||
1048 | $(t.o.tagsToRemove.join(','), t.$ed).remove(); |
- | ||
1049 | |
1052 | |
|
1050 | if (t.o.semantic) { |
1053 | if (t.o.semantic) { |
|
1051 | t.semanticTag('b', 'strong'); |
1054 | t.semanticTag('b', 'strong'); |
|
Line 1052... | Line 1055... | |||
1052 | t.semanticTag('i', 'em'); |
1055 | t.semanticTag('i', 'em'); |
|
Line 1128... | Line 1131... | |||
1128 | url = $a.attr('href'); |
1131 | url = $a.attr('href'); |
|
1129 | title = $a.attr('title'); |
1132 | title = $a.attr('title'); |
|
1130 | target = $a.attr('target'); |
1133 | target = $a.attr('target'); |
|
1131 | var range = t.doc.createRange(); |
1134 | var range = t.doc.createRange(); |
|
1132 | range.selectNode(node); |
1135 | range.selectNode(node); |
|
- | 1136 | documentSelection.removeAllRanges(); |
||
1133 | documentSelection.addRange(range); |
1137 | documentSelection.addRange(range); |
|
1134 | } |
1138 | } |
|
Line 1135... | Line 1139... | |||
1135 | |
1139 | |
|
Line 1177... | Line 1181... | |||
1177 | } |
1181 | } |
|
Line 1178... | Line 1182... | |||
1178 | |
1182 | |
|
1179 | if (node && node.nodeName === 'A') { |
1183 | if (node && node.nodeName === 'A') { |
|
1180 | var range = t.doc.createRange(); |
1184 | var range = t.doc.createRange(); |
|
- | 1185 | range.selectNode(node); |
||
1181 | range.selectNode(node); |
1186 | documentSelection.removeAllRanges(); |
|
1182 | documentSelection.addRange(range); |
1187 | documentSelection.addRange(range); |
|
1183 | } |
1188 | } |
|
1184 | } |
1189 | } |
|
1185 | t.execCmd('unlink', undefined, undefined, true); |
1190 | t.execCmd('unlink', undefined, undefined, true); |