mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-13 18:45:43 +05:00
Add webxdc app
This commit is contained in:
parent
06917a92c7
commit
ac88fe01a8
@ -31,6 +31,7 @@
|
||||
doc: #5170B5;
|
||||
presentation: #C65D27;
|
||||
file: #CD2532;
|
||||
webxdc: #964B00;
|
||||
}
|
||||
|
||||
@colortheme_static_apps: {
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
doc: #5170B5;
|
||||
presentation: #C65D27;
|
||||
file: #CD2532;
|
||||
webxdc: #964B00;
|
||||
}
|
||||
|
||||
@colortheme_static_apps: {
|
||||
|
||||
@ -17,3 +17,5 @@ if (typeof(module) !== 'undefined' && module.exports) {
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
Messages.type.webxdc= "webxdc (chess)"; //XXX
|
||||
|
||||
@ -17,7 +17,7 @@ const factory = () => {
|
||||
* You should never remove the drive from this list.
|
||||
*/
|
||||
AppConfig.availablePadTypes = ['drive', 'teams', 'sheet', 'doc', 'presentation', 'pad', 'kanban', 'code', 'form', 'poll', 'whiteboard',
|
||||
'file', 'contacts', 'slide', 'convert', 'diagram'];
|
||||
'file', 'contacts', 'slide', 'convert', 'diagram', 'webxdc'];
|
||||
|
||||
/* The registered only types are apps restricted to registered users.
|
||||
* You should never remove apps from this list unless you know what you're doing. The apps
|
||||
@ -219,7 +219,8 @@ const factory = () => {
|
||||
moderation: 'fa-ambulance',
|
||||
profile: 'fa-user-circle',
|
||||
support: 'fa-life-ring',
|
||||
accounts: 'fa-ticket'
|
||||
accounts: 'fa-ticket',
|
||||
webxdc: 'fa-chess'
|
||||
};
|
||||
|
||||
// Ability to create owned pads and expiring pads through a new pad creation screen.
|
||||
|
||||
35
www/webxdc/app-webxdc.less
Normal file
35
www/webxdc/app-webxdc.less
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
@import (reference) "../../customize/src/less2/include/framework.less";
|
||||
@import (reference) "../../customize/src/less2/include/tools.less";
|
||||
@import (reference) "../../customize/src/less2/include/avatar.less";
|
||||
|
||||
// body
|
||||
&.cp-app-webxdc {
|
||||
.framework_main(
|
||||
@bg-color: @colortheme_apps[webxdc],
|
||||
);
|
||||
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
max-height: 100%;
|
||||
min-height: auto;
|
||||
color: @cp_app-fg;
|
||||
background-color: @cp_app-bg;
|
||||
|
||||
#cp-app-webxdc-editor {
|
||||
display: flex;
|
||||
|
||||
#cp-webxdc-content {
|
||||
flex: 1;
|
||||
textarea {
|
||||
height: 300px;
|
||||
width: 800px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
29
www/webxdc/index.html
Normal file
29
www/webxdc/index.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CryptPad</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="referrer" content="no-referrer" />
|
||||
<script src="/customize/pre-loading.js?ver=1.1"></script>
|
||||
<link href="/customize/src/pre-loading.css?ver=1.0" rel="stylesheet" type="text/css">
|
||||
<script async data-bootload="/common/sframe-app-outer.js" data-main="/common/boot.js?ver=1.0" src="/components/requirejs/require.js?ver=2.3.7"></script>
|
||||
<link href="/customize/src/outer.css?ver=1.3.2" rel="stylesheet" type="text/css">
|
||||
<link id="favicon-ico" type="image/x-icon" rel="icon"
|
||||
data-main-favicon="/customize/favicon/main-favicon.ico"
|
||||
data-alt-favicon="/customize/favicon/alt-favicon.ico"
|
||||
href="/customize/favicon/main-favicon.ico">
|
||||
<link id="favicon" type="image/png" rel="icon"
|
||||
data-main-favicon="/customize/favicon/main-favicon.png"
|
||||
data-alt-favicon="/customize/favicon/alt-favicon.png"
|
||||
href="/customize/favicon/main-favicon.png">
|
||||
</head>
|
||||
<body>
|
||||
<noscript></noscript>
|
||||
<iframe-placeholder>
|
||||
27
www/webxdc/inner.html
Normal file
27
www/webxdc/inner.html
Normal file
@ -0,0 +1,27 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html class="cp-app-noscroll">
|
||||
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<script src="/customize/pre-loading.js?ver=1.1"></script>
|
||||
<link href="/customize/src/pre-loading.css?ver=1.0" rel="stylesheet" type="text/css">
|
||||
<script async data-bootload="/webxdc/inner.js" data-main="/common/sframe-boot.js?ver=1.11" src="/components/requirejs/require.js?ver=2.3.7"></script>
|
||||
<style>
|
||||
.loading-hidden {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="cp-app-webxdc">
|
||||
<div id="cme_toolbox" class="cp-toolbar-container"></div>
|
||||
<div id="cp-app-webxdc-editor"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
84
www/webxdc/inner.js
Normal file
84
www/webxdc/inner.js
Normal file
@ -0,0 +1,84 @@
|
||||
// SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// This is the initialization loading the CryptPad libraries
|
||||
define([
|
||||
'jquery',
|
||||
'/common/sframe-app-framework.js',
|
||||
'/customize/messages.js', // translation keys
|
||||
'/common/hyperscript.js',
|
||||
'less!/webxdc/app-webxdc.less'
|
||||
/* Here you can add your own javascript or css to load */
|
||||
], function (
|
||||
$,
|
||||
Framework,
|
||||
Messages,
|
||||
h,
|
||||
) {
|
||||
|
||||
|
||||
// This is the main initialization loop
|
||||
let onFrameworkReady = function (framework) {
|
||||
let $container = $('#cp-app-webxdc-editor');
|
||||
|
||||
let $content = $(h('div#cp-webxdc-content')).appendTo($container);
|
||||
let $textarea = $(h('textarea'));
|
||||
$content.append($textarea);
|
||||
let oldVal = '';
|
||||
$textarea.on('change keyup paste', function () {
|
||||
var currentVal = $textarea.val();
|
||||
if (currentVal === oldVal) { return; } // Nothing to do
|
||||
oldVal = currentVal;
|
||||
framework.localChange();
|
||||
});
|
||||
let getContent = () => {
|
||||
return $textarea.val();
|
||||
};
|
||||
let setContent = (value) => {
|
||||
return $textarea.val(value);
|
||||
};
|
||||
|
||||
let content = {};
|
||||
|
||||
// OPTIONAL: cursor management
|
||||
framework.setCursorGetter(() => {
|
||||
let myCursor = {};
|
||||
// Get your cursor position here
|
||||
return myCursor;
|
||||
});
|
||||
framework.onCursorUpdate(data => {
|
||||
console.log("Other user cursor", data);
|
||||
});
|
||||
|
||||
framework.onContentUpdate(function (newContent) {
|
||||
console.log('New content received from others', newContent.content);
|
||||
content = newContent.content;
|
||||
setContent(content);
|
||||
});
|
||||
|
||||
framework.setContentGetter(function () {
|
||||
let content = getContent();
|
||||
console.log('Sync my content with others', content);
|
||||
return {
|
||||
content: content
|
||||
};
|
||||
});
|
||||
|
||||
framework.onReady(function () {
|
||||
// Document is ready, you can initialize your app
|
||||
console.log('Document is ready:', content);
|
||||
});
|
||||
|
||||
// Start the framework
|
||||
framework.start();
|
||||
};
|
||||
|
||||
// Framework initialization
|
||||
Framework.create({
|
||||
toolbarContainer: '#cme_toolbox',
|
||||
contentContainer: '#cp-app-webxdc-editor'
|
||||
}, function (framework) {
|
||||
onFrameworkReady(framework);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user