textile_editor_helper 0.0.30 → 0.0.31
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.
- data/.gitignore +0 -0
- data/CHANGELOG.md +0 -0
- data/Gemfile +0 -0
- data/README.md +1 -2
- data/Rakefile +0 -0
- data/features/copy_assets.feature +0 -0
- data/features/step_definitions/common_steps.rb +0 -0
- data/features/step_definitions/rails_setup_steps.rb +0 -0
- data/features/support/env.rb +0 -0
- data/features/support/setup.rb +0 -0
- data/lib/generators/textile_editor_helper/install_generator.rb +0 -0
- data/lib/helpers/default.rb +0 -0
- data/lib/helpers/formtastic.rb +0 -0
- data/lib/helpers/simple_form.rb +0 -0
- data/lib/helpers/textile_editor_initialize.rb +0 -0
- data/lib/textile_editor_helper.rb +0 -0
- data/lib/textile_editor_helper/version.rb +1 -1
- data/test/abstract_unit.rb +0 -0
- data/test/formtastic_test.rb +0 -0
- data/test/simple_form_test.rb +0 -0
- data/test/support_methods.rb +0 -0
- data/test/test_helper.rb +0 -0
- data/test/textile_editor_helper_test.rb +0 -0
- data/textile_editor_helper.gemspec +0 -0
- data/travis.yml +0 -0
- data/vendor/README +0 -0
- data/vendor/assets/images/textile-editor/background.png +0 -0
- data/vendor/assets/images/textile-editor/blockquote.png +0 -0
- data/vendor/assets/images/textile-editor/bold.png +0 -0
- data/vendor/assets/images/textile-editor/center.png +0 -0
- data/vendor/assets/images/textile-editor/h1.png +0 -0
- data/vendor/assets/images/textile-editor/h2.png +0 -0
- data/vendor/assets/images/textile-editor/h3.png +0 -0
- data/vendor/assets/images/textile-editor/h4.png +0 -0
- data/vendor/assets/images/textile-editor/h5.png +0 -0
- data/vendor/assets/images/textile-editor/h6.png +0 -0
- data/vendor/assets/images/textile-editor/indent.png +0 -0
- data/vendor/assets/images/textile-editor/italic.png +0 -0
- data/vendor/assets/images/textile-editor/justify.png +0 -0
- data/vendor/assets/images/textile-editor/left.png +0 -0
- data/vendor/assets/images/textile-editor/list_bullets.png +0 -0
- data/vendor/assets/images/textile-editor/list_numbers.png +0 -0
- data/vendor/assets/images/textile-editor/omega.png +0 -0
- data/vendor/assets/images/textile-editor/outdent.png +0 -0
- data/vendor/assets/images/textile-editor/paragraph.png +0 -0
- data/vendor/assets/images/textile-editor/right.png +0 -0
- data/vendor/assets/images/textile-editor/strikethrough.png +0 -0
- data/vendor/assets/images/textile-editor/underline.png +0 -0
- data/vendor/assets/javascripts/textile-editor-config.js +0 -0
- data/vendor/assets/javascripts/textile-editor.js +127 -127
- data/vendor/assets/stylesheets/textile-editor.css +0 -0
- metadata +4 -4
data/.gitignore
CHANGED
|
File without changes
|
data/CHANGELOG.md
CHANGED
|
File without changes
|
data/Gemfile
CHANGED
|
File without changes
|
data/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Textile Editor Helper is a plugin for Ruby on Rails to add a Textile toolbar abo
|
|
|
5
5
|
This version of Textile Editor Helper is a fork of the code found at http://svn.webtest.wvu.edu/repos/rails/plugins/textile_editor_helper/ to allow for use with the form_for method.
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
##Dependencies
|
|
8
|
+
## Dependencies
|
|
9
9
|
|
|
10
10
|
To use Textile Editor Helper you must be using either the jQuery JavaScript library.
|
|
11
11
|
|
|
@@ -35,7 +35,6 @@ It's important that you read the example provided. Your application.js should lo
|
|
|
35
35
|
//= require jquery
|
|
36
36
|
//= require jquery_ujs
|
|
37
37
|
//= require textile-editor
|
|
38
|
-
//= require textile-editor-config
|
|
39
38
|
|
|
40
39
|
To use the Textile Editor Helper with a specific text area, you can choose between the following options:
|
|
41
40
|
|
data/Rakefile
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/features/support/env.rb
CHANGED
|
File without changes
|
data/features/support/setup.rb
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/helpers/default.rb
CHANGED
|
File without changes
|
data/lib/helpers/formtastic.rb
CHANGED
|
File without changes
|
data/lib/helpers/simple_form.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/test/abstract_unit.rb
CHANGED
|
File without changes
|
data/test/formtastic_test.rb
CHANGED
|
File without changes
|
data/test/simple_form_test.rb
CHANGED
|
File without changes
|
data/test/support_methods.rb
CHANGED
|
File without changes
|
data/test/test_helper.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/travis.yml
CHANGED
|
File without changes
|
data/vendor/README
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
/*
|
|
2
2
|
|
|
3
|
-
Textile Editor v0.2
|
|
4
|
-
created by: dave olsen, wvu web services
|
|
5
|
-
created on: march 17, 2007
|
|
6
|
-
project page: slateinfo.blogs.wvu.edu
|
|
3
|
+
Textile Editor v0.2
|
|
4
|
+
created by: dave olsen, wvu web services
|
|
5
|
+
created on: march 17, 2007
|
|
6
|
+
project page: slateinfo.blogs.wvu.edu
|
|
7
7
|
|
|
8
|
-
inspired by:
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
inspired by:
|
|
9
|
+
- Patrick Woods, http://www.hakjoon.com/code/38/textile-quicktags-redirect &
|
|
10
|
+
- Alex King, http://alexking.org/projects/js-quicktags
|
|
11
11
|
|
|
12
12
|
features:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
- supports: IE7, FF2, Safari2
|
|
14
|
+
- ability to use "simple" vs. "extended" editor
|
|
15
|
+
- supports all block elements in textile except footnote
|
|
16
|
+
- supports all block modifier elements in textile
|
|
17
|
+
- supports simple ordered and unordered lists
|
|
18
|
+
- supports most of the phrase modifiers, very easy to add the missing ones
|
|
19
|
+
- supports multiple-paragraph modification
|
|
20
|
+
- can have multiple "editors" on one page, access key use in this environment is flaky
|
|
21
|
+
- access key support
|
|
22
|
+
- select text to add and remove tags, selection stays highlighted
|
|
23
|
+
- seamlessly change between tags and modifiers
|
|
24
|
+
- doesn't need to be in the body onload tag
|
|
25
|
+
- can supply your own, custom IDs for the editor to be drawn around
|
|
26
26
|
|
|
27
27
|
todo:
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
- a clean way of providing image and link inserts
|
|
29
|
+
- get the selection to properly show in IE
|
|
30
30
|
|
|
31
31
|
more on textile:
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
- Textism, http://www.textism.com/tools/textile/index.php
|
|
33
|
+
- Textile Reference, http://hobix.com/textile/
|
|
34
34
|
|
|
35
35
|
*/
|
|
36
36
|
|
|
@@ -63,16 +63,16 @@ TextileEditor.Methods = {
|
|
|
63
63
|
var toolbar = document.createElement("div");
|
|
64
64
|
toolbar.id = "textile-toolbar-" + canvas;
|
|
65
65
|
toolbar.className = 'textile-toolbar';
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
this.canvas = document.getElementById(canvas);
|
|
68
|
-
this.canvas.parentNode.insertBefore(toolbar, this.canvas);
|
|
69
|
-
this.openTags = new Array();
|
|
68
|
+
this.canvas.parentNode.insertBefore(toolbar, this.canvas);
|
|
69
|
+
this.openTags = new Array();
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
// Create the local Button array by assigning theButtons array to edButtons
|
|
73
73
|
var edButtons = new Array();
|
|
74
74
|
edButtons = this.buttons;
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
var standardButtons = new Array();
|
|
77
77
|
for(var i = 0; i < edButtons.length; i++) {
|
|
78
78
|
var thisButton = this.prepareButton(edButtons[i]);
|
|
@@ -90,25 +90,25 @@ TextileEditor.Methods = {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
} // end for
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
var te = this;
|
|
95
95
|
var buttons = toolbar.getElementsByTagName('button');
|
|
96
96
|
for(var i = 0; i < buttons.length; i++) {
|
|
97
|
-
|
|
97
|
+
//$A(toolbar.getElementsByTagName('button')).each(function(button) {
|
|
98
98
|
if (!buttons[i].onclick) {
|
|
99
99
|
buttons[i].onclick = function() { te.insertTag(this); return false; }
|
|
100
100
|
} // end if
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
buttons[i].tagStart = buttons[i].getAttribute('tagStart');
|
|
103
103
|
buttons[i].tagEnd = buttons[i].getAttribute('tagEnd');
|
|
104
104
|
buttons[i].open = buttons[i].getAttribute('open');
|
|
105
105
|
buttons[i].textile_editor = te;
|
|
106
106
|
buttons[i].canvas = te.canvas;
|
|
107
107
|
// console.log(buttons[i].canvas);
|
|
108
|
-
|
|
108
|
+
//});
|
|
109
109
|
}
|
|
110
110
|
}, // end initialize
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
// draw individual buttons (edShowButton)
|
|
113
113
|
prepareButton: function(button) {
|
|
114
114
|
if (button.separator) {
|
|
@@ -134,9 +134,9 @@ TextileEditor.Methods = {
|
|
|
134
134
|
|
|
135
135
|
theButton.accessKey = button.access;
|
|
136
136
|
theButton.title = button.title;
|
|
137
|
-
return theButton;
|
|
137
|
+
return theButton;
|
|
138
138
|
}, // end prepareButton
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
// if clicked, no selected text, tag not open highlight button
|
|
141
141
|
// (edAddTag)
|
|
142
142
|
addTag: function(button) {
|
|
@@ -205,7 +205,7 @@ TextileEditor.Methods = {
|
|
|
205
205
|
|
|
206
206
|
// check if text has been selected
|
|
207
207
|
if (sel.text.length > 0) {
|
|
208
|
-
textSelected = true;
|
|
208
|
+
textSelected = true;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
// set-up newline regex's so we can swap tags across multiple paragraphs
|
|
@@ -229,7 +229,7 @@ TextileEditor.Methods = {
|
|
|
229
229
|
// check if text has been selected
|
|
230
230
|
if (startPos != endPos) {
|
|
231
231
|
textSelected = true;
|
|
232
|
-
var selectedText = myField.value.substring(startPos, endPos);
|
|
232
|
+
var selectedText = myField.value.substring(startPos, endPos);
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
// set-up newline regex's so we can swap tags across multiple paragraphs
|
|
@@ -269,14 +269,14 @@ TextileEditor.Methods = {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
// remove space from the end of the selectedText.
|
|
272
|
-
// Fixes a bug that causes any browser running under Microsoft Internet Explorer
|
|
272
|
+
// Fixes a bug that causes any browser running under Microsoft Internet Explorer
|
|
273
273
|
// to append an additional space before the closing element.
|
|
274
274
|
// *Bold text *here => *Bold text*
|
|
275
275
|
if (selectedText.match(/\s$/g)) {
|
|
276
276
|
selectedText = selectedText.replace(/\s$/g,'');
|
|
277
|
-
followupText = ' ';
|
|
277
|
+
followupText = ' ' + followupText;
|
|
278
278
|
}
|
|
279
|
-
|
|
279
|
+
|
|
280
280
|
// no clue, i'm sure it made sense at the time i wrote it
|
|
281
281
|
if (followupText.match(/^\n/)) {
|
|
282
282
|
newlineFollowup = '';
|
|
@@ -300,7 +300,7 @@ TextileEditor.Methods = {
|
|
|
300
300
|
}
|
|
301
301
|
re_replace = new RegExp(' (\\*|\\#) ','g');
|
|
302
302
|
|
|
303
|
-
// try to remove bullets in text copied from ms word **Mac Only!**
|
|
303
|
+
// try to remove bullets in text copied from ms word **Mac Only!**
|
|
304
304
|
re_word_bullet_m_s = new RegExp('• ','g'); // mac/safari
|
|
305
305
|
re_word_bullet_m_f = new RegExp('∑ ','g'); // mac/firefox
|
|
306
306
|
selectedText = selectedText.replace(re_word_bullet_m_s,'').replace(re_word_bullet_m_f,'');
|
|
@@ -311,10 +311,10 @@ TextileEditor.Methods = {
|
|
|
311
311
|
// if tag that begins the selection matches the one clicked, remove them all
|
|
312
312
|
if (selectedText.match(re_tag)) {
|
|
313
313
|
finalText = beginningText
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
314
|
+
+ newlineStart
|
|
315
|
+
+ selectedText.replace(re_replace,'')
|
|
316
|
+
+ newlineEnd
|
|
317
|
+
+ followupText;
|
|
318
318
|
if (matches = selectedText.match(/ (\*|\#) /g)) {
|
|
319
319
|
listItems = matches.length;
|
|
320
320
|
}
|
|
@@ -324,10 +324,10 @@ TextileEditor.Methods = {
|
|
|
324
324
|
// else replace the current tag type with the selected tag type
|
|
325
325
|
else {
|
|
326
326
|
finalText = beginningText
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
327
|
+
+ newlineStart
|
|
328
|
+
+ selectedText.replace(re_replace,button.tagStart)
|
|
329
|
+
+ newlineEnd
|
|
330
|
+
+ followupText;
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
|
|
@@ -335,16 +335,16 @@ TextileEditor.Methods = {
|
|
|
335
335
|
// NOTE: the items in a list will only be replaced if a newline starts with some character, not a space
|
|
336
336
|
else {
|
|
337
337
|
finalText = beginningText
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
338
|
+
+ newlineStart
|
|
339
|
+
+ button.tagStart
|
|
340
|
+
+ selectedText.replace(newlineReplaceRegexClean,newlineReplaceClean + button.tagStart).replace(/\n(\S)/g,'\n' + button.tagStart + '$1')
|
|
341
|
+
+ newlineEnd
|
|
342
|
+
+ followupText;
|
|
343
343
|
if (matches = selectedText.match(/\n(\S)/g)) {
|
|
344
344
|
listItems = matches.length;
|
|
345
345
|
}
|
|
346
346
|
posDiffPos = 3 + listItems*3;
|
|
347
|
-
}
|
|
347
|
+
}
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
// now lets look and see if the user is trying to muck with a block or block modifier
|
|
@@ -373,9 +373,9 @@ TextileEditor.Methods = {
|
|
|
373
373
|
}
|
|
374
374
|
|
|
375
375
|
// if tag already up is the same as the tag provided replace the whole tag
|
|
376
|
-
if (tagPartBlock == button.tagStart) {
|
|
376
|
+
if (tagPartBlock == button.tagStart) {
|
|
377
377
|
insertTag = tagPartBlock + tagPartModifierOrig; // use Orig because it's escaped for regex
|
|
378
|
-
drawSwitch = 0;
|
|
378
|
+
drawSwitch = 0;
|
|
379
379
|
}
|
|
380
380
|
// else if let's check to add/remove block modifier
|
|
381
381
|
else if ((tagPartModifier == button.tagStart) || (newm = tagPartModifier.match(/[\(]{2,}/g))) {
|
|
@@ -395,7 +395,7 @@ TextileEditor.Methods = {
|
|
|
395
395
|
else {
|
|
396
396
|
if (button.tagStart == tagPartModifier) {
|
|
397
397
|
insertTag = tagPartBlock;
|
|
398
|
-
|
|
398
|
+
} // going to rely on the default empty insertModifier
|
|
399
399
|
else {
|
|
400
400
|
|
|
401
401
|
if (button.tagStart.match(/(\>|\<\>|\<|\=)/g)) {
|
|
@@ -411,46 +411,46 @@ TextileEditor.Methods = {
|
|
|
411
411
|
}
|
|
412
412
|
// indentation of list items
|
|
413
413
|
else if (listPartMatches = re_list_items.exec(tagPartBlock)) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
414
|
+
var listTypeMatch = listPartMatches[1];
|
|
415
|
+
var indentLength = tagPartBlock.length - 2;
|
|
416
|
+
var listInsert = '';
|
|
417
|
+
if (button.tagStart == '(') {
|
|
418
|
+
indentLength = indentLength + 1;
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
indentLength = indentLength - 1;
|
|
422
|
+
}
|
|
423
|
+
if (listTypeMatch.match(/[\*]{1,}/g)) {
|
|
424
|
+
var listType = '*';
|
|
425
|
+
var listReplace = '\\*';
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
var listType = '#';
|
|
429
|
+
var listReplace = '\\#';
|
|
430
|
+
}
|
|
431
|
+
for (var i = 0; i < indentLength; i++) {
|
|
432
|
+
listInsert = listInsert + listType;
|
|
433
|
+
}
|
|
434
|
+
if (listInsert != '') {
|
|
435
|
+
insertTag = ' ' + listInsert + ' ';
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
insertTag = '';
|
|
439
|
+
}
|
|
440
|
+
tagPartBlock = tagPartBlock.replace(/(\*|\#)/g,listReplace);
|
|
441
|
+
drawSwitch = 1;
|
|
442
|
+
captureListStart = true;
|
|
443
|
+
periodAddition = '';
|
|
444
|
+
periodAdditionClean = '';
|
|
445
|
+
if (matches = selectedText.match(/\n\s/g)) {
|
|
446
|
+
listItemsAddition = matches.length;
|
|
447
|
+
}
|
|
448
448
|
}
|
|
449
449
|
// must be a block modification e.g. p>. to p<.
|
|
450
450
|
else {
|
|
451
451
|
|
|
452
452
|
// if this is a block modification/addition
|
|
453
|
-
if (button.tagStart.match(/(h1|h2|h3|h4|h5|h6|bq|p)/g)) {
|
|
453
|
+
if (button.tagStart.match(/(h1|h2|h3|h4|h5|h6|bq|p)/g)) {
|
|
454
454
|
if (tagPartBlock == '') {
|
|
455
455
|
drawSwitch = 2;
|
|
456
456
|
}
|
|
@@ -508,10 +508,10 @@ TextileEditor.Methods = {
|
|
|
508
508
|
if ((drawSwitch == 0) || (drawSwitch == 1)) {
|
|
509
509
|
if (drawSwitch == 0) { // completely removing a tag
|
|
510
510
|
finalText = beginningText
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
511
|
+
+ newlineStart
|
|
512
|
+
+ selectedText.replace(re_start,'').replace(re_middle,newlineReplaceClean)
|
|
513
|
+
+ newlineEnd
|
|
514
|
+
+ followupText;
|
|
515
515
|
if (matches = selectedText.match(newlineReplaceRegexClean)) {
|
|
516
516
|
mplier = mplier + matches.length;
|
|
517
517
|
}
|
|
@@ -519,10 +519,10 @@ TextileEditor.Methods = {
|
|
|
519
519
|
}
|
|
520
520
|
else { // modifying a tag, though we do delete bullets here
|
|
521
521
|
finalText = beginningText
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
522
|
+
+ newlineStart
|
|
523
|
+
+ selectedText.replace(re_old,insertTag + periodAdditionClean)
|
|
524
|
+
+ newlineEnd
|
|
525
|
+
+ followupText;
|
|
526
526
|
|
|
527
527
|
if (matches = selectedText.match(newlineReplaceRegexClean)) {
|
|
528
528
|
mplier = mplier + matches.length;
|
|
@@ -560,17 +560,17 @@ TextileEditor.Methods = {
|
|
|
560
560
|
}
|
|
561
561
|
else { // for adding tags other then bullets (have their own statement)
|
|
562
562
|
finalText = beginningText
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
563
|
+
+ newlineStart
|
|
564
|
+
+ insertTag + '. '
|
|
565
|
+
+ selectedText.replace(newlineReplaceRegexClean,button.tagEnd + '\n' + insertTag + '. ')
|
|
566
|
+
+ newlineFollowup
|
|
567
|
+
+ newlineEnd
|
|
568
|
+
+ followupText;
|
|
569
569
|
if (matches = selectedText.match(newlineReplaceRegexClean)) {
|
|
570
570
|
mplier = mplier + matches.length;
|
|
571
571
|
}
|
|
572
572
|
posDiffPos = insertTag.length + 2 + (mplier*4);
|
|
573
|
-
}
|
|
573
|
+
}
|
|
574
574
|
}
|
|
575
575
|
|
|
576
576
|
// swap in and out the simple tags around a selection like bold
|
|
@@ -582,10 +582,10 @@ TextileEditor.Methods = {
|
|
|
582
582
|
re_middle = new RegExp('\\' + button.tagEnd + newlineReplaceRegexDirty + '\\' + button.tagStart,'g');
|
|
583
583
|
if (selectedText.match(re_start) && selectedText.match(re_end)) {
|
|
584
584
|
finalText = beginningText
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
585
|
+
+ newlineStart
|
|
586
|
+
+ selectedText.replace(re_start,'').replace(re_end,'').replace(re_middle,newlineReplaceClean)
|
|
587
|
+
+ newlineEnd
|
|
588
|
+
+ followupText;
|
|
589
589
|
if (matches = selectedText.match(newlineReplaceRegexClean)) {
|
|
590
590
|
mplier = mplier + matches.length;
|
|
591
591
|
}
|
|
@@ -593,12 +593,12 @@ TextileEditor.Methods = {
|
|
|
593
593
|
}
|
|
594
594
|
else {
|
|
595
595
|
finalText = beginningText
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
596
|
+
+ newlineStart
|
|
597
|
+
+ button.tagStart
|
|
598
|
+
+ selectedText.replace(newlineReplaceRegexClean,button.tagEnd + newlineReplaceClean + button.tagStart)
|
|
599
|
+
+ button.tagEnd
|
|
600
|
+
+ newlineEnd
|
|
601
|
+
+ followupText;
|
|
602
602
|
if (matches = selectedText.match(newlineReplaceRegexClean)) {
|
|
603
603
|
mplier = mplier + matches.length;
|
|
604
604
|
}
|
|
@@ -625,14 +625,14 @@ TextileEditor.Methods = {
|
|
|
625
625
|
buttonStart = button.tagStart;
|
|
626
626
|
}
|
|
627
627
|
if (button.tagStart.match(re_p)) { // make sure that invoking block modifiers don't do anything
|
|
628
|
-
finalText = beginningText
|
|
629
|
-
|
|
628
|
+
finalText = beginningText
|
|
629
|
+
+ followupText;
|
|
630
630
|
cursorPos = startPos;
|
|
631
631
|
}
|
|
632
632
|
else {
|
|
633
|
-
finalText = beginningText
|
|
634
|
-
|
|
635
|
-
|
|
633
|
+
finalText = beginningText
|
|
634
|
+
+ buttonStart
|
|
635
|
+
+ followupText;
|
|
636
636
|
this.addTag(button);
|
|
637
637
|
cursorPos = startPos + buttonStart.length;
|
|
638
638
|
}
|
|
@@ -648,9 +648,9 @@ TextileEditor.Methods = {
|
|
|
648
648
|
else {
|
|
649
649
|
buttonEnd = button.tagEnd
|
|
650
650
|
}
|
|
651
|
-
finalText = beginningText
|
|
652
|
-
|
|
653
|
-
|
|
651
|
+
finalText = beginningText
|
|
652
|
+
+ button.tagEnd
|
|
653
|
+
+ followupText;
|
|
654
654
|
this.removeTag(button);
|
|
655
655
|
cursorPos = startPos + button.tagEnd.length;
|
|
656
656
|
}
|
|
@@ -684,4 +684,4 @@ destination = TextileEditor
|
|
|
684
684
|
source = TextileEditor.Methods
|
|
685
685
|
for(var property in source) destination[property] = source[property];
|
|
686
686
|
|
|
687
|
-
document.write('<script src="/assets/textile-editor-config.js" type="text/javascript"></script>');
|
|
687
|
+
document.write('<script src="/assets/textile-editor-config.js" type="text/javascript"></script>');
|
|
File without changes
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: textile_editor_helper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.31
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-10-16 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|
|
@@ -196,7 +196,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
196
196
|
version: '0'
|
|
197
197
|
segments:
|
|
198
198
|
- 0
|
|
199
|
-
hash: -
|
|
199
|
+
hash: -2675995419143999461
|
|
200
200
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
none: false
|
|
202
202
|
requirements:
|
|
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
205
205
|
version: '0'
|
|
206
206
|
segments:
|
|
207
207
|
- 0
|
|
208
|
-
hash: -
|
|
208
|
+
hash: -2675995419143999461
|
|
209
209
|
requirements: []
|
|
210
210
|
rubyforge_project:
|
|
211
211
|
rubygems_version: 1.8.24
|