Merge branch 'pad2' of github.com:xwiki-labs/cryptpad into pad2

This commit is contained in:
yflory
2017-08-22 18:19:06 +02:00
10 changed files with 56 additions and 22 deletions

View File

@@ -2,11 +2,7 @@
<html class="cp pad">
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link rel="stylesheet" href="/bower_components/components-font-awesome/css/font-awesome.min.css">
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
<script async data-bootload="/pad2/main.js" data-main="/common/sframe-boot.js?ver=1.0" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
<script src="/bower_components/ckeditor/ckeditor.js"></script>
<style>
html, body {
margin: 0px;

View File

@@ -1,4 +1,22 @@
console.log('one');
require(['/api/config'], function (ApiConfig) {
// see ckeditor_base.js getUrl()
window.CKEDITOR_GETURL = function (resource) {
if (resource.indexOf( '/' ) === 0) {
resource = window.CKEDITOR.basePath.replace(/\/bower_components\/.*/, '') + resource;
} else if (resource.indexOf(':/') === -1) {
resource = window.CKEDITOR.basePath + resource;
}
if (resource[resource.length - 1] !== '/' && resource.indexOf('ver=') === -1) {
var args = ApiConfig.requireConf.urlArgs;
if (resource.indexOf('/bower_components/') !== -1) {
args = 'ver=' + window.CKEDITOR.timestamp;
}
resource += (resource.indexOf('?') >= 0 ? '&' : '?') + args;
}
return resource;
};
require(['/bower_components/ckeditor/ckeditor.js']);
});
define([
'jquery',
'/bower_components/chainpad-crypto/crypto.js',
@@ -14,15 +32,17 @@ define([
'/pad/links.js',
'/bower_components/nthen/index.js',
'/common/sframe-common.js',
'/api/config',
'/bower_components/file-saver/FileSaver.min.js',
'/bower_components/diff-dom/diffDOM.js',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/cryptpad.less',
'less!/customize/src/less/toolbar.less'
], function ($, Crypto, Hyperjson,
Toolbar, Cursor, JsonOT, TypingTest, JSONSortify, TextPatcher, Cryptpad, Cryptget, Links, nThen, SFCommon) {
Toolbar, Cursor, JsonOT, TypingTest, JSONSortify, TextPatcher, Cryptpad, Cryptget, Links, nThen, SFCommon, ApiConfig) {
var saveAs = window.saveAs;
var Messages = Cryptpad.Messages;
var DiffDom = window.diffDOM;
@@ -725,6 +745,8 @@ define([
} else {
$('meta[name=viewport]').attr('content', 'width=device-width, initial-scale=1.0, user-scalable=yes');
}
// Used in ckeditor-config.js
Ckeditor.CRYPTPAD_URLARGS = ApiConfig.requireConf.urlArgs;
editor = Ckeditor.replace('editor1', {
customConfig: '/customize/ckeditor-config.js',
});

View File

@@ -4,14 +4,17 @@ define([
'/common/requireconfig.js',
'/common/cryptget.js'
], function (ApiConfig, $, RequireConfig, Cryptget) {
var requireConfig = RequireConfig();
$(function () {
var req = {
cfg: RequireConfig,
cfg: requireConfig,
req: [ '/common/loading.js' ],
pfx: window.location.origin
};
window.rc = requireConfig;
window.apiconf = ApiConfig;
$('#sbox-iframe').attr('src',
ApiConfig.httpSafeOrigin + '/pad2/inner.html?' + ApiConfig.requireConf.urlArgs +
ApiConfig.httpSafeOrigin + '/pad2/inner.html?' + requireConfig.urlArgs +
'#' + encodeURIComponent(JSON.stringify(req)));
});
require([
@@ -21,7 +24,6 @@ define([
'/common/cryptpad-common.js',
'/bower_components/chainpad-crypto/crypto.js'
], function (SFrameChannel, CpNfOuter, nThen, Cryptpad, Crypto) {
console.log('xxx');
var sframeChan;
var hashes;
var secret;