Skip to content

Commit

Permalink
[VE] Add draw editor
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Nov 14, 2024
1 parent 5f62b3d commit eddb65e
Show file tree
Hide file tree
Showing 64 changed files with 13,291 additions and 21 deletions.
18 changes: 11 additions & 7 deletions apps/api/documents/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
type: 'desktop or mobile or embedded',
width: '100% by default',
height: '100% by default',
documentType: 'word' | 'cell' | 'slide' | 'pdf' ,// deprecate 'text' | 'spreadsheet' | 'presentation',
documentType: 'word' | 'cell' | 'slide' | 'pdf' | 'draw' ,// deprecate 'text' | 'spreadsheet' | 'presentation',
token: <string> encrypted signature
document: {
title: 'document title',
Expand Down Expand Up @@ -466,11 +466,12 @@
'word': 'docx',
'cell': 'xlsx',
'slide': 'pptx',
'pdf': 'pdf'
'pdf': 'pdf',
'draw': 'vsdx'
}, app;

if (_config.documentType=='text' || _config.documentType=='spreadsheet' ||_config.documentType=='presentation')
console.warn("The \"documentType\" parameter for the config object must take one of the values word/cell/slide/pdf.");
console.warn("The \"documentType\" parameter for the config object must take one of the values word/cell/slide/pdf/draw.");

if (typeof _config.documentType === 'string' && _config.documentType != '') {
app = appMap[_config.documentType.toLowerCase()];
Expand All @@ -484,7 +485,7 @@

if (typeof _config.document.fileType === 'string' && _config.document.fileType != '') {
_config.document.fileType = _config.document.fileType.toLowerCase();
var type = /^(?:(xls|xlsx|ods|csv|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb|sxc|et|ett)|(pps|ppsx|ppt|pptx|odp|gslides|pot|potm|potx|ppsm|pptm|fodp|otp|sxi|dps|dpt)|(pdf|djvu|xps|oxps)|(doc|docx|odt|gdoc|txt|rtf|mht|htm|html|mhtml|epub|docm|dot|dotm|dotx|fodt|ott|fb2|xml|oform|docxf|sxw|stw|wps|wpt))$/
var type = /^(?:(xls|xlsx|ods|csv|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb|sxc|et|ett)|(pps|ppsx|ppt|pptx|odp|gslides|pot|potm|potx|ppsm|pptm|fodp|otp|sxi|dps|dpt)|(pdf|djvu|xps|oxps)|(doc|docx|odt|gdoc|txt|rtf|mht|htm|html|mhtml|epub|docm|dot|dotm|dotx|fodt|ott|fb2|xml|oform|docxf|sxw|stw|wps|wpt)|(vsdx))$/
.exec(_config.document.fileType);
if (!type) {
window.alert("The \"document.fileType\" parameter for the config object is invalid. Please correct it.");
Expand All @@ -493,7 +494,8 @@
if (typeof type[1] === 'string') _config.documentType = 'cell'; else
if (typeof type[2] === 'string') _config.documentType = 'slide'; else
if (typeof type[3] === 'string') _config.documentType = 'pdf'; else
if (typeof type[4] === 'string') _config.documentType = 'word';
if (typeof type[4] === 'string') _config.documentType = 'word'; else
if (typeof type[5] === 'string') _config.documentType = 'draw';
}
}

Expand Down Expand Up @@ -1019,6 +1021,7 @@
'cell': 'spreadsheeteditor',
'slide': 'presentationeditor',
'pdf': 'pdfeditor',
'draw': 'visioeditor',
'common': 'common'
},
appType = 'word',
Expand All @@ -1027,7 +1030,7 @@
isForm = false;
if (config.document) {
if (typeof config.document.fileType === 'string')
type = /^(?:(pdf)|(djvu|xps|oxps)|(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(oform|docxf))$/
type = /^(?:(pdf)|(djvu|xps|oxps)|(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(oform|docxf)|(vsdx))$/
.exec(config.document.fileType);

if (config.document.permissions)
Expand All @@ -1049,7 +1052,8 @@
appType = config.documentType.toLowerCase();
else {
if (type && typeof type[3] === 'string') appType = 'cell'; else
if (type && typeof type[4] === 'string') appType = 'slide';
if (type && typeof type[4] === 'string') appType = 'slide'; else
if (type && typeof type[6] === 'string') appType = 'draw';
}
}
if (!(config.editorConfig && config.editorConfig.shardkey && config.document && config.editorConfig.shardkey!==config.document.key))
Expand Down
12 changes: 7 additions & 5 deletions apps/common/main/lib/controller/Desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ define([
], function () {
'use strict';

var webapp = window.DE || window.PE || window.SSE || window.PDFE;
var webapp = window.DE || window.PE || window.SSE || window.PDFE || window.VE;
var features = Object.assign({
version: '{{PRODUCT_VERSION}}',
eventloading: true,
Expand Down Expand Up @@ -296,7 +296,8 @@ define([
if ( !!titlebuttons.quickprint ) {
const var_name = window.SSE ? 'sse-settings-quick-print-button' :
window.PE ? 'pe-settings-quick-print-button' :
window.PDFE ? 'pdfe-settings-quick-print-button' : 'de-settings-quick-print-button';
window.PDFE ? 'pdfe-settings-quick-print-button' :
window.VE ? 've-settings-quick-print-button' : 'de-settings-quick-print-button';
const is_btn_visible = Common.localStorage.getBool(var_name, false);

if ( titlebuttons.quickprint.visible != is_btn_visible ) {
Expand Down Expand Up @@ -617,7 +618,7 @@ define([
menu.hide();
} else
if ( action == 'create:fromtemplate' ) {
native.execCommand('create:new', 'template:' + (!!window.SSE ? 'cell' : !!window.PE ? 'slide' : !!window.PDFE ? 'form' :
native.execCommand('create:new', 'template:' + (!!window.SSE ? 'cell' : !!window.PE ? 'slide' : !!window.VE ? 'draw' : !!window.PDFE ? 'form' :
window.PDFE || config.isPDFForm ? 'form' : 'word'));
menu.hide();
}
Expand Down Expand Up @@ -651,7 +652,7 @@ define([
} else
if ( opts == 'create:new' ) {
if (config.createUrl == 'desktop://create.new') {
native.execCommand("create:new", !!window.SSE ? 'cell' : !!window.PE ? 'slide' :
native.execCommand("create:new", !!window.SSE ? 'cell' : !!window.PE ? 'slide' :!!window.VE ? 'draw' :
window.PDFE || config.isPDFForm ? 'form' : 'word');
return true;
}
Expand Down Expand Up @@ -693,7 +694,8 @@ define([
if ( !!nativevars && nativevars.helpUrl ) {
var webapp = window.SSE ? 'spreadsheeteditor' :
window.PE ? 'presentationeditor' :
window.PDFE ? 'pdfeditor' : 'documenteditor';
window.PDFE ? 'pdfeditor' :
window.VE ? 'visioeditor' : 'documenteditor';
return nativevars.helpUrl + '/' + webapp + '/main/resources/help';
}

Expand Down
4 changes: 2 additions & 2 deletions apps/common/main/lib/controller/FocusManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ Common.UI.FocusManager = new(function() {
item.selector = '.listview';
else if (field instanceof Common.UI.CheckBox)
item.selector = '.checkbox-indeterminate';
else if (field instanceof Common.UI.RadioBox)
else if (Common.UI.RadioBox && field instanceof Common.UI.RadioBox)
item.selector = '.radiobox';
else if (field instanceof Common.UI.TreeView)
else if (Common.UI.TreeView && field instanceof Common.UI.TreeView)
item.selector = '.treeview';
else if (field instanceof Common.UI.Button)
item.selector = field.split ? '.btn-group' : 'button';
Expand Down
2 changes: 1 addition & 1 deletion apps/common/main/lib/controller/LaunchController.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ define([
const load_scripts = function () {
const me = this;

const app = window.DE || window.PE || window.SSE || window.PDFE;
const app = window.DE || window.PE || window.SSE || window.PDFE || window.VE;
!app.postLaunchScripts && (app.postLaunchScripts = []);
// console.log('on_app_ready', app.postLaunchScripts);

Expand Down
2 changes: 1 addition & 1 deletion apps/common/main/lib/controller/Plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ define([
loadConfig: function(data) {
var me = this;
me.configPlugins.config = data.config.plugins;
me.editor = !!window.PDFE ? 'pdf' : !!window.DE ? 'word' : !!window.PE ? 'slide' : 'cell';
me.editor = !!window.PDFE ? 'pdf' : !!window.DE ? 'word' : !!window.PE ? 'slide' : !!window.VE ? 'draw' : 'cell';
me.isPDFEditor = !!window.PDFE;
},

Expand Down
2 changes: 1 addition & 1 deletion apps/common/main/lib/controller/ScreenReaderFocus.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Common.UI.ScreenReaderFocusManager = new(function() {
if (Common.Utils.isIE || Common.UI.isMac && Common.Utils.isGecko) // turn off hints on IE and FireFox (shortcut F6 selects link in address bar)
return;
_api = api;
_app = window.DE || window.PE || window.SSE || window.PDFE;
_app = window.DE || window.PE || window.SSE || window.PDFE || window.VE;
_isDocReady = true;

var filter = Common.localStorage.getKeysFilter();
Expand Down
4 changes: 2 additions & 2 deletions apps/common/main/lib/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ define([], function () {

Common.Utils.showBrowserRestriction = function () {
if (document.getElementsByClassName && document.getElementsByClassName('app-error-panel').length > 0) return;
var editor = (window.DE ? 'Document' : window.SSE ? 'Spreadsheet' : window.PE ? 'Presentation' : window.PDFE ? 'PDF' : 'that');
var editor = (window.DE ? 'Document' : window.SSE ? 'Spreadsheet' : window.PE ? 'Presentation' : window.PDFE ? 'PDF' : window.VE ? 'Visio' : 'that');
var newDiv = document.createElement("div");
newDiv.innerHTML = '<div class="app-error-panel">' +
'<div class="message-block">' +
Expand Down Expand Up @@ -1206,7 +1206,7 @@ define([], function () {
if (opts.disablefunc)
opts.disablefunc(true);

var app = window.DE || window.PE || window.SSE || window.PDFE;
var app = window.DE || window.PE || window.SSE || window.PDFE || window.VE;

Common.UI.warning({
msg: Common.Locale.get("warnFileLocked", {
Expand Down
2 changes: 1 addition & 1 deletion apps/common/main/lib/view/DocumentHolderExt.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
define([], function () {
'use strict';

let _editor = window.DE || window.PDFE ||window.PDFE || window.PE || window.SSE;
let _editor = window.DE || window.PDFE ||window.PDFE || window.PE || window.SSE || window.VE;
if (_editor && _editor.Views && _editor.Views.DocumentHolder) {
let dh = _editor.Views.DocumentHolder.prototype;

Expand Down
4 changes: 4 additions & 0 deletions apps/common/main/resources/less/colors-table-ie-fix.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@
@toolbar-header-spreadsheet-ie: #40865c;
@toolbar-header-presentation-ie: #BE664F;
@toolbar-header-pdf-ie: #AA5252;
@toolbar-header-visio-ie: #444796;

@text-toolbar-header-on-background-document-ie: #38567A;
@text-toolbar-header-on-background-spreadsheet-ie: #336B49;
@text-toolbar-header-on-background-presentation-ie: #854535;
@text-toolbar-header-on-background-pdf-ie: #8D4444;
@text-toolbar-header-on-background-visio-ie: #444796;

@tab-header-document-ie: #fff;
@tab-header-spreadsheet-ie: #fff;
@tab-header-presentation-ie: #fff;
@tab-header-pdf-ie: #fff;
@tab-header-visio-ie: #fff;

@tab-toolbar-document-ie: #446995;
@tab-toolbar-spreadsheet-ie: #40865c;
@tab-toolbar-presentation-ie: #BE664F;
@tab-toolbar-pdf-ie: #AA5252;
@tab-toolbar-visio-ie: #444796;

@background-normal-ie: #fff;
@background-toolbar-ie: #f1f1f1;
Expand Down
4 changes: 4 additions & 0 deletions apps/common/main/resources/less/colors-table.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
--toolbar-header-spreadsheet: #40865c;
--toolbar-header-presentation: #BE664F;
--toolbar-header-pdf: #AA5252;
--toolbar-header-visio: #444796;

--text-toolbar-header-on-background-document: #38567A;
--text-toolbar-header-on-background-spreadsheet: #336B49;
--text-toolbar-header-on-background-presentation: #854535;
--text-toolbar-header-on-background-pdf: #8D4444;
--text-toolbar-header-on-background-visio: #444796;

--background-normal: #fff;
--background-toolbar: #f7f7f7;
Expand Down Expand Up @@ -87,11 +89,13 @@
--highlight-header-tab-underline-spreadsheet: var(--text-toolbar-header);
--highlight-header-tab-underline-presentation: var(--text-toolbar-header);
--highlight-header-tab-underline-pdf: var(--text-toolbar-header);
--highlight-header-tab-underline-visio: var(--text-toolbar-header);

--highlight-toolbar-tab-underline-document: #446995;
--highlight-toolbar-tab-underline-spreadsheet: #40865c;
--highlight-toolbar-tab-underline-presentation: #BE664F;
--highlight-toolbar-tab-underline-pdf: #AA5252;
--highlight-toolbar-tab-underline-visio: #444796;

// Canvas

Expand Down
Loading

0 comments on commit eddb65e

Please sign in to comment.