You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cryptpad/www/pad/main.js

41 lines
1.5 KiB
JavaScript

10 years ago
define([
'/api/config?cb=' + Math.random().toString(16).substring(2),
'/pad/realtime-wysiwyg.js',
'/common/messages.js',
'/common/crypto.js',
'/bower_components/jquery/dist/jquery.min.js',
'/bower_components/ckeditor/ckeditor.js',
], function (Config, RTWysiwyg, Messages, Crypto) {
10 years ago
var Ckeditor = window.CKEDITOR;
var $ = window.jQuery;
10 years ago
$(function () {
$(window).on('hashchange', function() {
window.location.reload();
});
if (window.location.href.indexOf('#') === -1) {
window.location.href = window.location.href + '#' + Crypto.genKey();
return;
}
var key = Crypto.parseKey(window.location.hash.substring(1));
10 years ago
var editor = Ckeditor.replace('editor1', {
removeButtons: 'Source,Maximize',
// This plugin inserts html crap into the document which is not part of the document
// itself and causes problems when it's sent across the wire and reflected back.
10 years ago
removePlugins: 'magicline'
10 years ago
});
editor.on('instanceReady', function () {
10 years ago
editor.execCommand('maximize');
10 years ago
var ifr = window.ifr = $('iframe')[0];
ifr.contentDocument.body.innerHTML = Messages.initialState;
10 years ago
var rtw =
RTWysiwyg.start(Config.websocketURL,
Crypto.rand64(8),
key.channel,
10 years ago
key.cryptKey);
editor.on('change', function () { rtw.onEvent(); });
});
});
});