-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
13 changed files
with
771 additions
and
724 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,44 @@ | ||
if (!RedactorPlugins) var RedactorPlugins = {}; | ||
|
||
RedactorPlugins.counter = function() | ||
(function($) | ||
{ | ||
return { | ||
init: function() | ||
{ | ||
if (!this.opts.counterCallback) return; | ||
|
||
this.$editor.on('keyup.redactor-limiter', $.proxy(function(e) | ||
RedactorPlugins.counter = function() | ||
{ | ||
return { | ||
init: function() | ||
{ | ||
var words = 0, characters = 0, spaces = 0; | ||
if (!this.opts.counterCallback) return; | ||
|
||
this.$editor.on('keyup.redactor-limiter', $.proxy(function(e) | ||
{ | ||
var words = 0, characters = 0, spaces = 0; | ||
|
||
var html = this.code.get(); | ||
var html = this.code.get(); | ||
|
||
var text = html.replace(/<\/(.*?)>/gi, ' '); | ||
text = text.replace(/<(.*?)>/gi, ''); | ||
text = text.replace(/\t/gi, ''); | ||
text = text.replace(/\n/gi, ''); | ||
text = text.replace(/\r/gi, ''); | ||
text = $.trim(text); | ||
var text = html.replace(/<\/(.*?)>/gi, ' '); | ||
text = text.replace(/<(.*?)>/gi, ''); | ||
text = text.replace(/\t/gi, ''); | ||
text = text.replace(/\n/gi, ''); | ||
text = text.replace(/\r/gi, ''); | ||
text = $.trim(text); | ||
|
||
if (text !== '') | ||
{ | ||
var arrWords = text.split(/\s+/); | ||
var arrSpaces = text.match(/\s/g); | ||
if (text !== '') | ||
{ | ||
var arrWords = text.split(/\s+/); | ||
var arrSpaces = text.match(/\s/g); | ||
|
||
if (arrWords) words = arrWords.length; | ||
if (arrSpaces) spaces = arrSpaces.length; | ||
if (arrWords) words = arrWords.length; | ||
if (arrSpaces) spaces = arrSpaces.length; | ||
|
||
characters = text.length; | ||
characters = text.length; | ||
|
||
} | ||
} | ||
|
||
this.core.setCallback('counter', { words: words, characters: characters, spaces: spaces }); | ||
this.core.setCallback('counter', { words: words, characters: characters, spaces: spaces }); | ||
|
||
|
||
}, this)); | ||
} | ||
}, this)); | ||
} | ||
}; | ||
}; | ||
}; | ||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,53 @@ | ||
if (!RedactorPlugins) var RedactorPlugins = {}; | ||
|
||
RedactorPlugins.definedlinks = function() | ||
(function($) | ||
{ | ||
return { | ||
init: function() | ||
{ | ||
if (!this.opts.definedLinks) return; | ||
RedactorPlugins.definedlinks = function() | ||
{ | ||
return { | ||
init: function() | ||
{ | ||
if (!this.opts.definedLinks) return; | ||
|
||
this.modal.addCallback('link', $.proxy(this.definedlinks.load, this)); | ||
this.modal.addCallback('link', $.proxy(this.definedlinks.load, this)); | ||
|
||
}, | ||
load: function() | ||
{ | ||
var $select = $('<select id="redactor-defined-links" />'); | ||
$('#redactor-modal-link-insert').prepend($select); | ||
}, | ||
load: function() | ||
{ | ||
var $select = $('<select id="redactor-defined-links" />'); | ||
$('#redactor-modal-link-insert').prepend($select); | ||
|
||
this.definedlinks.storage = {}; | ||
this.definedlinks.storage = {}; | ||
|
||
$.getJSON(this.opts.definedLinks, $.proxy(function(data) | ||
{ | ||
$.each(data, $.proxy(function(key, val) | ||
$.getJSON(this.opts.definedLinks, $.proxy(function(data) | ||
{ | ||
this.definedlinks.storage[key] = val; | ||
$select.append($('<option>').val(key).html(val.name)); | ||
$.each(data, $.proxy(function(key, val) | ||
{ | ||
this.definedlinks.storage[key] = val; | ||
$select.append($('<option>').val(key).html(val.name)); | ||
|
||
}, this)); | ||
}, this)); | ||
|
||
$select.on('change', $.proxy(this.definedlinks.select, this)); | ||
$select.on('change', $.proxy(this.definedlinks.select, this)); | ||
|
||
}, this)); | ||
}, this)); | ||
|
||
}, | ||
select: function(e) | ||
{ | ||
var key = $(e.target).val(); | ||
var name = '', url = ''; | ||
if (key !== 0) | ||
}, | ||
select: function(e) | ||
{ | ||
name = this.definedlinks.storage[key].name; | ||
url = this.definedlinks.storage[key].url; | ||
} | ||
var key = $(e.target).val(); | ||
var name = '', url = ''; | ||
if (key !== 0) | ||
{ | ||
name = this.definedlinks.storage[key].name; | ||
url = this.definedlinks.storage[key].url; | ||
} | ||
|
||
$('#redactor-link-url').val(url); | ||
$('#redactor-link-url').val(url); | ||
|
||
var $el = $('#redactor-link-url-text'); | ||
if ($el.val() === '') $el.val(name); | ||
} | ||
var $el = $('#redactor-link-url-text'); | ||
if ($el.val() === '') $el.val(name); | ||
} | ||
}; | ||
}; | ||
}; | ||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,64 @@ | ||
if (!RedactorPlugins) var RedactorPlugins = {}; | ||
|
||
RedactorPlugins.filemanager = function() | ||
(function($) | ||
{ | ||
return { | ||
init: function() | ||
{ | ||
if (!this.opts.fileManagerJson) return; | ||
|
||
this.modal.addCallback('file', this.filemanager.load); | ||
}, | ||
load: function() | ||
{ | ||
var $modal = this.modal.getModal(); | ||
|
||
this.modal.createTabber($modal); | ||
this.modal.addTab(1, 'Upload', 'active'); | ||
this.modal.addTab(2, 'Choose'); | ||
|
||
$('#redactor-modal-file-upload-box').addClass('redactor-tab redactor-tab1'); | ||
|
||
var $box = $('<div id="redactor-file-manager-box" style="overflow: auto; height: 300px;" class="redactor-tab redactor-tab2">').hide(); | ||
$modal.append($box); | ||
|
||
|
||
$.ajax({ | ||
dataType: "json", | ||
cache: false, | ||
url: this.opts.fileManagerJson, | ||
success: $.proxy(function(data) | ||
{ | ||
var ul = $('<ul id="redactor-modal-list">'); | ||
$.each(data, $.proxy(function(key, val) | ||
RedactorPlugins.filemanager = function() | ||
{ | ||
return { | ||
init: function() | ||
{ | ||
if (!this.opts.fileManagerJson) return; | ||
|
||
this.modal.addCallback('file', this.filemanager.load); | ||
}, | ||
load: function() | ||
{ | ||
var $modal = this.modal.getModal(); | ||
|
||
this.modal.createTabber($modal); | ||
this.modal.addTab(1, 'Upload', 'active'); | ||
this.modal.addTab(2, 'Choose'); | ||
|
||
$('#redactor-modal-file-upload-box').addClass('redactor-tab redactor-tab1'); | ||
|
||
var $box = $('<div id="redactor-file-manager-box" style="overflow: auto; height: 300px;" class="redactor-tab redactor-tab2">').hide(); | ||
$modal.append($box); | ||
|
||
|
||
$.ajax({ | ||
dataType: "json", | ||
cache: false, | ||
url: this.opts.fileManagerJson, | ||
success: $.proxy(function(data) | ||
{ | ||
var a = $('<a href="#" title="' + val.title + '" rel="' + val.link + '">' + val.title + ' <span style="font-size: 11px; color: #888;">' + val.name + '</span> <span style="position: absolute; right: 10px; font-size: 11px; color: #888;">(' + val.size + ')</span></a>'); | ||
var li = $('<li />'); | ||
var ul = $('<ul id="redactor-modal-list">'); | ||
$.each(data, $.proxy(function(key, val) | ||
{ | ||
var a = $('<a href="#" title="' + val.title + '" rel="' + val.link + '" class="redactor-file-manager-link">' + val.title + ' <span style="font-size: 11px; color: #888;">' + val.name + '</span> <span style="position: absolute; right: 10px; font-size: 11px; color: #888;">(' + val.size + ')</span></a>'); | ||
var li = $('<li />'); | ||
|
||
a.on('click', $.proxy(this.filemanager.insert, this)); | ||
|
||
a.on('click', $.proxy(this.filemanager.insert, this)); | ||
li.append(a); | ||
ul.append(li); | ||
|
||
li.append(a); | ||
ul.append(li); | ||
}, this)); | ||
|
||
}, this)); | ||
$('#redactor-file-manager-box').append(ul); | ||
|
||
$('#redactor-file-manager-box').append(ul); | ||
|
||
}, this) | ||
}); | ||
|
||
}, this) | ||
}); | ||
}, | ||
insert: function(e) | ||
{ | ||
e.preventDefault(); | ||
|
||
}, | ||
insert: function(e) | ||
{ | ||
e.preventDefault(); | ||
var $target = $(e.target).closest('.redactor-file-manager-link'); | ||
|
||
this.file.insert('<a href="' + $(e.target).attr('rel') + '">' + $(e.target).attr('title') + '</a>'); | ||
} | ||
this.file.insert('<a href="' + $target.attr('rel') + '">' + $target.attr('title') + '</a>'); | ||
} | ||
}; | ||
}; | ||
}; | ||
})(jQuery); |
Oops, something went wrong.