mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
Implement require
of dependencies for all pad_*
modules.
Create a lazily-defined local reference for pad on initialization in each pad module in order to avoid circular dependency. At some point in the future this dependency should instead be injected into each module on initialization.
This commit is contained in:
parent
7f98116a43
commit
fa2a6e9ee6
11 changed files with 62 additions and 5 deletions
|
@ -20,6 +20,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var padutils = require('/pad_utils').padutils;
|
||||
var paddocbar = require('/pad_docbar').paddocbar;
|
||||
|
||||
var padsavedrevs = (function()
|
||||
{
|
||||
|
@ -39,7 +41,7 @@ var padsavedrevs = (function()
|
|||
box.find(".srauthor").html("by " + padutils.escapeHtml(revisionInfo.savedBy));
|
||||
var viewLink = '/ep/pad/view/' + pad.getPadId() + '/' + revisionInfo.id;
|
||||
box.find(".srview").attr('href', viewLink);
|
||||
var restoreLink = 'javascript:void padsavedrevs.restoreRevision(' + rnum + ');';
|
||||
var restoreLink = 'javascript:void(require('+JSON.stringify(module.id)+').padsavedrevs.restoreRevision(' + JSON.stringify(rnum) + ');';
|
||||
box.find(".srrestore").attr('href', restoreLink);
|
||||
box.find(".srname").click(function(evt)
|
||||
{
|
||||
|
@ -345,9 +347,11 @@ var padsavedrevs = (function()
|
|||
$(document).unbind('mouseup', clearScrollRepeatTimer);
|
||||
}
|
||||
|
||||
var pad = undefined;
|
||||
var self = {
|
||||
init: function(initialRevisions)
|
||||
{
|
||||
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected).
|
||||
self.newRevisionList(initialRevisions, true);
|
||||
|
||||
$("#savedrevs-savenow").click(function()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue