mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-12 02:01:31 -04:00
Merge branch 'develop' of github.com:sciunto/etherpad-lite
Conflicts: src/package.json src/templates/timeslider.html
This commit is contained in:
commit
7761409374
43 changed files with 530 additions and 143 deletions
|
@ -122,6 +122,11 @@ function Ace2Editor()
|
|||
return info.ace_getDebugProperty(prop);
|
||||
};
|
||||
|
||||
editor.getInInternationalComposition = function()
|
||||
{
|
||||
return info.ace_getInInternationalComposition();
|
||||
};
|
||||
|
||||
// prepareUserChangeset:
|
||||
// Returns null if no new changes or ACE not ready. Otherwise, bundles up all user changes
|
||||
// to the latest base text into a Changeset, which is returned (as a string if encodeAsString).
|
||||
|
|
|
@ -1173,7 +1173,7 @@ function Ace2Inner(){
|
|||
//if (! top.BEFORE) top.BEFORE = [];
|
||||
//top.BEFORE.push(magicdom.root.dom.innerHTML);
|
||||
//if (! isEditable) return; // and don't reschedule
|
||||
if (window.parent.parent.inInternationalComposition)
|
||||
if (inInternationalComposition)
|
||||
{
|
||||
// don't do idle input incorporation during international input composition
|
||||
idleWorkTimer.atLeast(500);
|
||||
|
@ -3729,7 +3729,7 @@ function Ace2Inner(){
|
|||
thisKeyDoesntTriggerNormalize = true;
|
||||
}
|
||||
|
||||
if ((!specialHandled) && (!thisKeyDoesntTriggerNormalize) && (!window.parent.parent.inInternationalComposition))
|
||||
if ((!specialHandled) && (!thisKeyDoesntTriggerNormalize) && (!inInternationalComposition))
|
||||
{
|
||||
if (type != "keyup" || !incorpIfQuick())
|
||||
{
|
||||
|
@ -4589,9 +4589,24 @@ function Ace2Inner(){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
var inInternationalComposition = false;
|
||||
function handleCompositionEvent(evt)
|
||||
{
|
||||
window.parent.parent.handleCompositionEvent(evt);
|
||||
// international input events, fired in FF3, at least; allow e.g. Japanese input
|
||||
if (evt.type == "compositionstart")
|
||||
{
|
||||
inInternationalComposition = true;
|
||||
}
|
||||
else if (evt.type == "compositionend")
|
||||
{
|
||||
inInternationalComposition = false;
|
||||
}
|
||||
}
|
||||
|
||||
editorInfo.ace_getInInternationalComposition = function ()
|
||||
{
|
||||
return inInternationalComposition;
|
||||
}
|
||||
|
||||
function bindTheEventHandlers()
|
||||
|
|
|
@ -111,7 +111,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
|
||||
function handleUserChanges()
|
||||
{
|
||||
if (window.parent.parent.inInternationalComposition) return;
|
||||
if (editor.getInInternationalComposition()) return;
|
||||
if ((!getSocket()) || channelState == "CONNECTING")
|
||||
{
|
||||
if (channelState == "CONNECTING" && (((+new Date()) - initialStartConnectTime) > 20000))
|
||||
|
@ -288,7 +288,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
var apool = msg.apool;
|
||||
|
||||
// When inInternationalComposition, msg pushed msgQueue.
|
||||
if (msgQueue.length > 0 || window.parent.parent.inInternationalComposition) {
|
||||
if (msgQueue.length > 0 || editor.getInInternationalComposition()) {
|
||||
if (msgQueue.length > 0) oldRev = msgQueue[msgQueue.length - 1].newRev;
|
||||
else oldRev = rev;
|
||||
|
||||
|
@ -358,6 +358,14 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
{
|
||||
var userInfo = msg.userInfo;
|
||||
var id = userInfo.userId;
|
||||
|
||||
// Avoid a race condition when setting colors. If our color was set by a
|
||||
// query param, ignore our own "new user" message's color value.
|
||||
if (id === initialUserInfo.userId && initialUserInfo.globalUserColor)
|
||||
{
|
||||
msg.userInfo.colorId = initialUserInfo.globalUserColor;
|
||||
}
|
||||
|
||||
|
||||
if (userSet[id])
|
||||
{
|
||||
|
|
|
@ -24,6 +24,13 @@
|
|||
|
||||
var colorutils = {};
|
||||
|
||||
// Check that a given value is a css hex color value, e.g.
|
||||
// "#ffffff" or "#fff"
|
||||
colorutils.isCssHex = function(cssColor)
|
||||
{
|
||||
return /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(cssColor);
|
||||
}
|
||||
|
||||
// "#ffffff" or "#fff" or "ffffff" or "fff" to [1.0, 1.0, 1.0]
|
||||
colorutils.css2triple = function(cssColor)
|
||||
{
|
||||
|
|
|
@ -311,7 +311,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
['insertorder', 'first']
|
||||
].concat(
|
||||
_.map(state.lineAttributes,function(value,key){
|
||||
if (window.console) console.log([key, value])
|
||||
if (typeof(window)!= 'undefined' && window.console) console.log([key, value])
|
||||
return [key, value];
|
||||
})
|
||||
);
|
||||
|
|
|
@ -43,6 +43,7 @@ var padmodals = require('./pad_modals').padmodals;
|
|||
var padsavedrevs = require('./pad_savedrevs');
|
||||
var paduserlist = require('./pad_userlist').paduserlist;
|
||||
var padutils = require('./pad_utils').padutils;
|
||||
var colorutils = require('./colorutils').colorutils;
|
||||
|
||||
var createCookie = require('./pad_utils').createCookie;
|
||||
var readCookie = require('./pad_utils').readCookie;
|
||||
|
@ -50,22 +51,6 @@ var randomString = require('./pad_utils').randomString;
|
|||
|
||||
var hooks = require('./pluginfw/hooks');
|
||||
|
||||
window.inInternationalComposition = false;
|
||||
var inInternationalComposition = window.inInternationalComposition;
|
||||
|
||||
window.handleCompositionEvent = function handleCompositionEvent(evt)
|
||||
{
|
||||
// international input events, fired in FF3, at least; allow e.g. Japanese input
|
||||
if (evt.type == "compositionstart")
|
||||
{
|
||||
this.inInternationalComposition = true;
|
||||
}
|
||||
else if (evt.type == "compositionend")
|
||||
{
|
||||
this.inInternationalComposition = false;
|
||||
}
|
||||
}
|
||||
|
||||
function createCookie(name, value, days, path)
|
||||
{
|
||||
if (days)
|
||||
|
@ -114,6 +99,7 @@ function getParams()
|
|||
var showControls = params["showControls"];
|
||||
var showChat = params["showChat"];
|
||||
var userName = params["userName"];
|
||||
var userColor = params["userColor"];
|
||||
var showLineNumbers = params["showLineNumbers"];
|
||||
var useMonospaceFont = params["useMonospaceFont"];
|
||||
var IsnoColors = params["noColors"];
|
||||
|
@ -162,6 +148,11 @@ function getParams()
|
|||
// If the username is set as a parameter we should set a global value that we can call once we have initiated the pad.
|
||||
settings.globalUserName = decodeURIComponent(userName);
|
||||
}
|
||||
if(userColor)
|
||||
// If the userColor is set as a parameter, set a global value to use once we have initiated the pad.
|
||||
{
|
||||
settings.globalUserColor = decodeURIComponent(userColor);
|
||||
}
|
||||
if(rtl)
|
||||
{
|
||||
if(rtl == "true")
|
||||
|
@ -363,6 +354,14 @@ function handshake()
|
|||
pad.myUserInfo.name = settings.globalUserName;
|
||||
$('#myusernameedit').attr({"value":settings.globalUserName}); // Updates the current users UI
|
||||
}
|
||||
if (settings.globalUserColor !== false && colorutils.isCssHex(settings.globalUserColor))
|
||||
{
|
||||
|
||||
// Add a 'globalUserColor' property to myUserInfo, so collabClient knows we have a query parameter.
|
||||
pad.myUserInfo.globalUserColor = settings.globalUserColor;
|
||||
pad.notifyChangeColor(settings.globalUserColor); // Updates pad.myUserInfo.colorId
|
||||
paduserlist.setMyUserInfo(pad.myUserInfo);
|
||||
}
|
||||
}
|
||||
//This handles every Message after the clientVars
|
||||
else
|
||||
|
@ -1025,6 +1024,7 @@ var settings = {
|
|||
, noColors: false
|
||||
, useMonospaceFontGlobal: false
|
||||
, globalUserName: false
|
||||
, globalUserColor: false
|
||||
, rtlIsTrue: false
|
||||
};
|
||||
|
||||
|
|
|
@ -85,11 +85,13 @@ var padeditor = (function()
|
|||
if (value == "false") return false;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
self.ace.setProperty("rtlIsTrue", settings.rtlIsTrue);
|
||||
|
||||
var v;
|
||||
|
||||
v = getOption('rtlIsTrue', false);
|
||||
self.ace.setProperty("rtlIsTrue", v);
|
||||
|
||||
v = getOption('showLineNumbers', true);
|
||||
self.ace.setProperty("showslinenumbers", v);
|
||||
padutils.setCheckbox($("#options-linenoscheck"), v);
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
var plugins = require("ep_etherpad-lite/static/js/pluginfw/plugins");
|
||||
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
|
||||
var npm = require("npm");
|
||||
var registry = require("npm/lib/utils/npm-registry-client/index.js");
|
||||
var RegClient = require("npm-registry-client")
|
||||
|
||||
var registry = new RegClient(
|
||||
{ registry: "http://registry.npmjs.org"
|
||||
, cache: npm.cache }
|
||||
);
|
||||
|
||||
var withNpm = function (npmfn, final, cb) {
|
||||
npm.load({}, function (er) {
|
||||
|
@ -72,7 +77,7 @@ exports.search = function(query, cache, cb) {
|
|||
cb(null, exports.searchCache);
|
||||
} else {
|
||||
registry.get(
|
||||
"/-/all", null, 600, false, true,
|
||||
"/-/all", 600, false, true,
|
||||
function (er, data) {
|
||||
if (er) return cb(er);
|
||||
exports.searchCache = data;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
var npm = require("npm/lib/npm.js");
|
||||
var readInstalled = require("./read-installed.js");
|
||||
var relativize = require("npm/lib/utils/relativize.js");
|
||||
var readJson = require("npm/lib/utils/read-json.js");
|
||||
var path = require("path");
|
||||
var async = require("async");
|
||||
var fs = require("fs");
|
||||
|
|
|
@ -94,8 +94,21 @@ var npm = require("npm/lib/npm.js")
|
|||
, path = require("path")
|
||||
, asyncMap = require("slide").asyncMap
|
||||
, semver = require("semver")
|
||||
, readJson = require("npm/lib/utils/read-json.js")
|
||||
, log = require("npm/lib/utils/log.js")
|
||||
, log = require("log4js").getLogger('pluginfw')
|
||||
|
||||
function readJson(file, callback) {
|
||||
fs.readFile(file, function(er, buf) {
|
||||
if(er) {
|
||||
callback(er);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
callback( null, JSON.parse(buf.toString()) )
|
||||
} catch(er) {
|
||||
callback(er)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = readInstalled
|
||||
|
||||
|
@ -274,7 +287,7 @@ function findUnmet (obj) {
|
|||
}
|
||||
|
||||
})
|
||||
log.verbose([obj._id], "returning")
|
||||
log.debug([obj._id], "returning")
|
||||
return obj
|
||||
}
|
||||
|
||||
|
|
|
@ -144,13 +144,12 @@ function handleClientVars(message)
|
|||
require('./pad_impexp').padimpexp.init();
|
||||
|
||||
//change export urls when the slider moves
|
||||
var export_rev_regex = /(\/\d+)?\/export/
|
||||
BroadcastSlider.onSlider(function(revno)
|
||||
{
|
||||
// export_links is a jQuery Array, so .each is allowed.
|
||||
export_links.each(function()
|
||||
{
|
||||
this.setAttribute('href', this.href.replace(export_rev_regex, '/' + revno + '/export'));
|
||||
this.setAttribute('href', this.href.replace( /(.+?)\/\w+\/(\d+\/)?export/ , '$1/' + padId + '/' + revno + '/export'));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue