Separate UI elements from cryptpad-common
This commit is contained in:
@@ -2,9 +2,12 @@ define([
|
||||
'jquery',
|
||||
'/common/modes.js',
|
||||
'/common/themes.js',
|
||||
'/common/cryptpad-common.js',
|
||||
'/customize/messages.js',
|
||||
'/common/common-ui-elements.js',
|
||||
'/common/common-hash.js',
|
||||
'/common/common-util.js',
|
||||
'/bower_components/textpatcher/TextPatcher.js',
|
||||
], function ($, Modes, Themes, Cryptpad, TextPatcher) {
|
||||
], function ($, Modes, Themes, Messages, UIElements, Hash, Util, TextPatcher) {
|
||||
var module = {};
|
||||
|
||||
var cursorToPos = function(cursor, oldText) {
|
||||
@@ -101,7 +104,6 @@ define([
|
||||
|
||||
module.create = function (Common, defaultMode, CMeditor) {
|
||||
var exp = {};
|
||||
var Messages = Cryptpad.Messages;
|
||||
|
||||
var CodeMirror = exp.CodeMirror = CMeditor;
|
||||
CodeMirror.modeURL = "cm/mode/%N/%N";
|
||||
@@ -211,7 +213,7 @@ define([
|
||||
isSelect: true,
|
||||
feedback: 'CODE_LANGUAGE',
|
||||
};
|
||||
var $block = exp.$language = Cryptpad.createDropdown(dropdownConfig);
|
||||
var $block = exp.$language = UIElements.createDropdown(dropdownConfig);
|
||||
$block.find('button').attr('title', Messages.languageButtonTitle);
|
||||
$block.find('a').click(function () {
|
||||
setMode($(this).attr('data-value'), onModeChanged);
|
||||
@@ -248,7 +250,7 @@ define([
|
||||
initialValue: lastTheme,
|
||||
feedback: 'CODE_THEME',
|
||||
};
|
||||
var $block = exp.$theme = Cryptpad.createDropdown(dropdownConfig);
|
||||
var $block = exp.$theme = UIElements.createDropdown(dropdownConfig);
|
||||
$block.find('button').attr('title', Messages.themeButtonTitle);
|
||||
|
||||
setTheme(lastTheme, $block);
|
||||
@@ -324,8 +326,8 @@ define([
|
||||
//var cursor = editor.getCursor();
|
||||
//var cleanName = data.name.replace(/[\[\]]/g, '');
|
||||
//var text = '';
|
||||
var parsed = Cryptpad.parsePadUrl(data.url);
|
||||
var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);
|
||||
var parsed = Hash.parsePadUrl(data.url);
|
||||
var hexFileName = Util.base64ToHex(parsed.hashData.channel);
|
||||
var src = '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName;
|
||||
var mt = '<media-tag src="' + src + '" data-crypto-key="cryptpad:' +
|
||||
parsed.hashData.key + '"></media-tag>';
|
||||
|
||||
Reference in New Issue
Block a user