Iniit
Этот коммит содержится в:
@@ -0,0 +1,529 @@
|
||||
var Unibase;
|
||||
(function (Unibase) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Collaboration;
|
||||
(function (Collaboration) {
|
||||
let Components;
|
||||
(function (Components) {
|
||||
let DocEditor;
|
||||
(function (DocEditor) {
|
||||
class Base {
|
||||
init(response, res, callback) {
|
||||
this.result = response.result;
|
||||
this.documentGroup = this.result.DocumentGroup;
|
||||
this.filedata = res.result;
|
||||
this.FileName = response.result.FileTitle;
|
||||
this.FileId = response.result.FileId;
|
||||
this.sourceFileId = response.result.SourceFileId;
|
||||
this.Priority = response.result.Priority;
|
||||
this.lastEditedTime = response.result.LastUpdateTime;
|
||||
this.timePeriod = response.result.TimePeriod;
|
||||
this.username = response.result.LastUpdateByName;
|
||||
this.Priority = response.result.Priority;
|
||||
this.newUpload = response.result.NewUpload;
|
||||
this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
|
||||
this.unibaseusername = this.identity.name.trim();
|
||||
this.NewDocument = response.result.NewDocument;
|
||||
this.render();
|
||||
if (callback != null) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
unwireBootStrapKeyEvent() {
|
||||
let popup = document.body.getElementsByClassName('_bizgaze_popup_container');
|
||||
let events = $._data($(popup)[0], "events");
|
||||
if (events && events.keydown) {
|
||||
$(popup).off('keydown.dismiss.bs.modal', events.keydown[0].handler);
|
||||
}
|
||||
}
|
||||
render() {
|
||||
this.renderPopup();
|
||||
this.updateProps();
|
||||
this.renderMenuBar();
|
||||
this.refreshHeight();
|
||||
this.wordDocumentRender();
|
||||
this.ribbon.init(this.wordDocumentObj, this.result);
|
||||
this.priorityRender();
|
||||
this.initSetInterval();
|
||||
this.eventListeners();
|
||||
this.unwireBootStrapKeyEvent();
|
||||
if (!this.NewDocument) {
|
||||
this.connectHub(this.FileId, this.documentGroup);
|
||||
}
|
||||
}
|
||||
connectHub(fileId, documentgroup) {
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(["apps/collaboration/components/docconnector.js", "apps/collaboration/components/unidochub.js"], function () {
|
||||
Unibase.Apps.Collaboration.Components.DocConnector.Instance().init(fileId, documentgroup);
|
||||
});
|
||||
}
|
||||
priorityRender() {
|
||||
if (this.Priority) {
|
||||
$(".biz_doc_star_icon_" + this.FileId).removeClass("fa-star-o");
|
||||
$(".biz_doc_star_icon_" + this.FileId).addClass("fa-star");
|
||||
$(".biz_doc_star_icon_" + this.FileId).removeClass("text-light");
|
||||
$(".biz_doc_star_icon_" + this.FileId).css("color", "orange");
|
||||
}
|
||||
}
|
||||
eventListeners() {
|
||||
try {
|
||||
document.body.addEventListener("keydown", this.keyDown.bind(this));
|
||||
document.body.addEventListener("mousedown", this.mouseDown.bind(this));
|
||||
document.getElementsByClassName("biz-doc-starred")[0].addEventListener('click', (event) => {
|
||||
});
|
||||
document.getElementsByClassName("biz-doc-filename")[0].addEventListener('focusout', (event) => {
|
||||
this.fileNameChange();
|
||||
});
|
||||
(document.getElementsByClassName('e-de-text-target')[0].contentWindow.document).addEventListener("keydown", (ele) => {
|
||||
if (ele.keyCode == 122) {
|
||||
event.preventDefault();
|
||||
this.openFullscreen(this.container);
|
||||
}
|
||||
});
|
||||
(document.getElementsByClassName('e-de-text-target')[0].contentWindow.document).addEventListener("keyup", (ele) => {
|
||||
this.editorkeyUp(ele);
|
||||
});
|
||||
(document.getElementsByClassName('e-de-text-target')[0].contentWindow.document).addEventListener("mousedown", (ele) => {
|
||||
this.editorMouseDown(ele);
|
||||
});
|
||||
this.container.addEventListener("fullscreenchange", () => {
|
||||
this.fullscreenHandler(this.container);
|
||||
});
|
||||
this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.addEventListener("beforeOpen", this.cmenuBfOpen.bind(this));
|
||||
this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.addEventListener("beforeItemRender", this.cmenuBfItemRndr.bind(this));
|
||||
this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.addEventListener("select", this.cmenuSelect.bind(this));
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
keyDown(ele) {
|
||||
if (ele.keyCode == 122) {
|
||||
event.preventDefault();
|
||||
setTimeout(() => { this.openFullscreen(this.container); }, 0);
|
||||
}
|
||||
if (ele.target.classList.contains("biz-doc-fileshare-btn")) {
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('apps/collaboration/components/unicloud.js', () => {
|
||||
Unibase.Apps.Collaboration.Components.UniCloud.Instance().share(this.sourceFileId, "File", 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
editorkeyUp(e) {
|
||||
this.updateUndoRedo();
|
||||
}
|
||||
updateUndoRedo() {
|
||||
let undoOverley = document.getElementById("DocumentViewer_toolbar_undo").parentElement.classList.contains("e-overlay");
|
||||
let redoOverley = document.getElementById("DocumentViewer_toolbar_redo").parentElement.classList.contains("e-overlay");
|
||||
let undobtn = document.getElementsByClassName("biz-doc-undo")[0];
|
||||
let redobtn = document.getElementsByClassName("biz-doc-redo")[0];
|
||||
this.enableOrDisableIcon(undoOverley, undobtn);
|
||||
this.enableOrDisableIcon(redoOverley, redobtn);
|
||||
}
|
||||
editorMouseDown(e) {
|
||||
let undo = e.target.closest(".biz-doc-undo");
|
||||
let redo = e.target.closest(".biz-doc-redo");
|
||||
(undo) && document.getElementById("DocumentViewer_toolbar_undo").click();
|
||||
(redo) && document.getElementById("DocumentViewer_toolbar_redo").click();
|
||||
this.updateUndoRedo();
|
||||
}
|
||||
mouseDown(e) {
|
||||
if (e.target.id == "biz_doc_undobtn" || e.target.classList.contains("biz-doc-undo-icon")) {
|
||||
document.getElementById("DocumentViewer_toolbar_undo").click();
|
||||
}
|
||||
else if (e.target.id == "biz_doc_redobtn" || e.target.classList.contains("biz-doc-redo-icon")) {
|
||||
document.getElementById("DocumentViewer_toolbar_redo").click();
|
||||
}
|
||||
this.updateUndoRedo();
|
||||
}
|
||||
enableOrDisableIcon(undoOverley, btn) {
|
||||
if (undoOverley) {
|
||||
if (!btn.classList.contains("e-disabled"))
|
||||
btn.classList.add("e-disabled");
|
||||
}
|
||||
else {
|
||||
if (btn.classList.contains("e-disabled"))
|
||||
btn.classList.remove("e-disabled");
|
||||
}
|
||||
}
|
||||
openFullscreen(elem) {
|
||||
if (elem.requestFullscreen) {
|
||||
elem.requestFullscreen();
|
||||
}
|
||||
else if (elem.webkitRequestFullscreen) {
|
||||
elem.webkitRequestFullscreen();
|
||||
}
|
||||
else if (elem.msRequestFullscreen) {
|
||||
elem.msRequestFullscreen();
|
||||
}
|
||||
}
|
||||
fullscreenHandler(container) {
|
||||
setTimeout(() => {
|
||||
if (document.fullscreenElement) {
|
||||
this.fullscreenChange(container);
|
||||
}
|
||||
else {
|
||||
this.fullscreenChange(container);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
fullscreenChange(ele) {
|
||||
let ribbonHeight = this.ribbonElem.offsetHeight;
|
||||
let toolbarHeight = document.getElementsByClassName("biz-doc-bottomtoolbar")[0].offsetHeight;
|
||||
let footerHeight = this.element.parentElement.nextElementSibling.offsetHeight;
|
||||
var totalHeight = window.innerHeight - ribbonHeight - toolbarHeight - footerHeight;
|
||||
this.element.parentElement.style.height = totalHeight + 'px';
|
||||
this.wordDocumentObj.height = totalHeight + 'px';
|
||||
}
|
||||
wordDocumentRender() {
|
||||
var instance = this;
|
||||
this.wordDocumentObj = new ej.documenteditor.DocumentEditorContainer({
|
||||
height: "100%",
|
||||
enableEditor: true,
|
||||
enableEditorHistory: true,
|
||||
enableSelection: true,
|
||||
enableSearch: true,
|
||||
created: () => {
|
||||
setTimeout(() => {
|
||||
let updateTextPositionFn = this.wordDocumentObj.documentEditor.selectionModule.updateTextPosition.bind(this.wordDocumentObj.documentEditor.selectionModule);
|
||||
this.wordDocumentObj.documentEditor.selectionModule.updateTextPosition = (a1, a2) => {
|
||||
updateTextPositionFn(a1, a2);
|
||||
let result = this.wordDocumentObj.documentEditor.selectionModule.updateTextPositionIn(a1, undefined, 0, a2, false);
|
||||
this.formatInfo = result;
|
||||
return result;
|
||||
};
|
||||
}, 800);
|
||||
},
|
||||
});
|
||||
setInterval(() => {
|
||||
var instance = this;
|
||||
if (instance.contentChanged) {
|
||||
this.onlineStatus = (window.navigator.onLine ? 'on' : 'off') + 'line';
|
||||
window.addEventListener('online', () => document.getElementsByClassName('biz-ss-cloudsave')[0].style.display = 'inline-block');
|
||||
window.addEventListener('online', () => document.getElementsByClassName("biz-ss-cloudoff")[0].style.display = "none");
|
||||
window.addEventListener('offline', () => document.getElementsByClassName('biz-ss-cloudsave')[0].style.display = 'none');
|
||||
window.addEventListener('offline', () => document.getElementsByClassName("biz-ss-cloudoff")[0].style.display = "inline-block");
|
||||
if (this.onlineStatus == "online") {
|
||||
Unibase.Apps.Collaboration.Components.Common.Download.Instance().saveDocumentFile(instance.FileId, instance.documentGroup, instance.documentContainer).then(function () {
|
||||
});
|
||||
}
|
||||
instance.contentChanged = false;
|
||||
}
|
||||
}, 3000);
|
||||
this.wordDocumentObj.appendTo('.DocumentViewer');
|
||||
(this.filedata) && this.wordDocumentObj.documentEditor.open(this.filedata);
|
||||
this.wordDocumentObj.documentEditor.enableSfdtExport = true;
|
||||
this.wordDocumentObj.documentEditor.enableWordExport = true;
|
||||
this.wordDocumentObj.documentEditor.enableTextExport = true;
|
||||
this.wordDocumentObj.documentEditor.enableSelection = true;
|
||||
this.wordDocumentObj.documentEditor.enableEditor = true;
|
||||
this.wordDocumentObj.documentEditor.isReadOnly = false;
|
||||
this.wordDocumentObj.documentEditor.enableLocalPaste = false;
|
||||
var xyz = $("#DocumentViewer_editor")[0];
|
||||
this.documentContainer = xyz.ej2_instances[0];
|
||||
}
|
||||
cmenuBfOpen(args) {
|
||||
let cmenuModule = this.wordDocumentObj.documentEditor.contextMenuModule;
|
||||
let items = this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.items;
|
||||
if (items.find(x => x.id == this.wordDocumentObj.element.id + "_cmenu_delete") == undefined) {
|
||||
items.splice(5, 0, {
|
||||
text: "Delete", iconCss: "e-icons MT_Delete", id: this.wordDocumentObj.element.id + "_cmenu_delete"
|
||||
});
|
||||
items.push({ text: "Clear Formatting", iconCss: "e-icons MT_ClearFormat", id: this.wordDocumentObj.element.id + "_cmenu_clear_formatting" });
|
||||
}
|
||||
this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.items = items;
|
||||
this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.dataBind();
|
||||
cmenuModule.showHideElements(cmenuModule.documentHelper.selection);
|
||||
}
|
||||
cmenuBfItemRndr(e) {
|
||||
if (e.item.id == this.wordDocumentObj.element.id + "_cmenu_delete") {
|
||||
let selectedText = this.wordDocumentObj.documentEditor.editor.selection.text;
|
||||
if (selectedText.length == 0) {
|
||||
e.element.classList.add("e-disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
cmenuSelect(args) {
|
||||
if (args.item.id == this.wordDocumentObj.element.id + "_cmenu_delete") {
|
||||
this.wordDocumentObj.documentEditor.editor.delete();
|
||||
}
|
||||
else if (args.item.id == this.wordDocumentObj.element.id + "_cmenu_clear_formatting") {
|
||||
this.wordDocumentObj.documentEditor.editor.clearFormatting();
|
||||
}
|
||||
}
|
||||
updateProps() {
|
||||
this.element = document.getElementById('DocumentViewer');
|
||||
this.fileName = this.result.FileName + "." + this.result.FileType;
|
||||
this.ribbon = Unibase.Apps.Collaboration.Components.DocEditor.Ribbon.Instance();
|
||||
this.util = Unibase.Apps.Collaboration.Components.Common.Util.Instance();
|
||||
}
|
||||
refreshHeight() {
|
||||
var toolbarHeight = this.element.parentElement.previousElementSibling.offsetHeight;
|
||||
var rootHeight = this.element.parentElement.parentElement.offsetHeight;
|
||||
var rbnHeight = document.body.getElementsByClassName('biz-doc-ribbon')[0].offsetHeight;
|
||||
this.element.parentElement.style.height = (rootHeight - rbnHeight - toolbarHeight) + 'px';
|
||||
}
|
||||
initSetInterval() {
|
||||
if (this.timePeriod === "Minutes" || this.timePeriod === "Minute") {
|
||||
this.intr = setInterval(() => {
|
||||
this.lastEditedTime = this.lastEditedTime + 1;
|
||||
this.username = this.username;
|
||||
this.timePeriod = this.timePeriod;
|
||||
if (this.lastEditedTime != 1) {
|
||||
if (this.lastEditedTime >= 59 && this.timePeriod === "Minutes") {
|
||||
Unibase.Apps.Collaboration.DocumentManager.Instance().lastEdit(this.FileId).then((response) => {
|
||||
this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
|
||||
this.unibaseusername = this.identity.name.trim();
|
||||
this.lastEditedTime = response.result.Lastedittime;
|
||||
this.username = response.result.LastUpdatedByName;
|
||||
this.timePeriod = response.result.TimePeriod;
|
||||
if (this.unibaseusername === this.username) {
|
||||
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
|
||||
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
|
||||
}
|
||||
else {
|
||||
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
|
||||
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago by " + this.username;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
|
||||
this.unibaseusername = this.identity.name.trim();
|
||||
if (this.unibaseusername === this.username) {
|
||||
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
|
||||
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
|
||||
}
|
||||
else {
|
||||
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
|
||||
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago by " + this.username;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 60000);
|
||||
}
|
||||
else if (this.timePeriod === "Hour" || this.timePeriod === "Hours") {
|
||||
this.intrhour = setInterval(() => {
|
||||
this.lastEditedTime = this.lastEditedTime + 1;
|
||||
this.username = this.username;
|
||||
this.timePeriod = this.timePeriod;
|
||||
if (this.lastEditedTime >= 23 && this.timePeriod === "Hours") {
|
||||
Unibase.Apps.Collaboration.DocumentManager.Instance().lastEdit(this.FileId).then((response) => {
|
||||
this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
|
||||
this.unibaseusername = this.identity.name.trim();
|
||||
this.lastEditedTime = response.result.Lastedittime;
|
||||
this.username = response.result.LastUpdatedByName;
|
||||
this.timePeriod = response.result.TimePeriod;
|
||||
if (this.unibaseusername === this.username) {
|
||||
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
|
||||
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
|
||||
}
|
||||
else {
|
||||
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
|
||||
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago by " + this.username;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
|
||||
this.unibaseusername = this.identity.name.trim();
|
||||
if (this.unibaseusername === this.username) {
|
||||
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
|
||||
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
|
||||
}
|
||||
else {
|
||||
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
|
||||
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago by " + this.username;
|
||||
}
|
||||
}
|
||||
}, 3600000);
|
||||
}
|
||||
}
|
||||
fileNameChange() {
|
||||
var tempfilename = $(".biz-doc-filename").val();
|
||||
var data = {
|
||||
FileTitle: tempfilename,
|
||||
FileId: this.FileId
|
||||
};
|
||||
Unibase.Apps.Collaboration.DocumentManager.Instance().renameFileTitle(data);
|
||||
}
|
||||
activeUsers(FileUsers) {
|
||||
var connecteduser = [];
|
||||
for (var v in FileUsers) {
|
||||
let identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
|
||||
let unibaseId = identity.unibaseId;
|
||||
if (unibaseId != FileUsers[v].unibaseId) {
|
||||
connecteduser.push(FileUsers[v].firstName);
|
||||
}
|
||||
}
|
||||
this.connecteduserfirstName = connecteduser;
|
||||
console.log(this.connecteduserfirstName);
|
||||
this.showActiveUsers(FileUsers);
|
||||
return this.connecteduserfirstName;
|
||||
}
|
||||
showActiveUsers(FileUsers) {
|
||||
var onlineusername = document.getElementsByClassName("biz-doc-onlineusersintials")[0];
|
||||
let identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
|
||||
let unibaseId = identity.unibaseId;
|
||||
var connectedUsersFirstChar = [];
|
||||
for (var user in this.connecteduserfirstName) {
|
||||
connectedUsersFirstChar.push(this.connecteduserfirstName[user].trim().charAt(0));
|
||||
}
|
||||
var element = document.getElementById('biz-doc-connected_users_container');
|
||||
if (typeof (element) != 'undefined' && element != null) {
|
||||
element.remove();
|
||||
}
|
||||
let html = "";
|
||||
let html1 = `<div id="biz-doc-connected_users_container"></div>`;
|
||||
$(".biz-doc-onlineusersintials").append(html1);
|
||||
let usersHtml = '', randomColor;
|
||||
let colorPalette = ['#6640b2', '#3a55b1', '#0092ee', '#00acf0', '#1ebccd', '#009b84', '#22af47', '#88c241', '#d0d962', '#fde335', '#ffbf36', '#ff9528', '#ff6028', '#7a5449', '#c1993f', '#9e9e9e', '#5e7d8a', '#324148', '#f5f5f6', '#f95851', '#ef3975', '#b642b5', '#7a59bc', '#536bbb', '#21a0f0', '#21b7f2'];
|
||||
for (let i = 0; i < this.connecteduserfirstName.length; i++) {
|
||||
randomColor = colorPalette[Math.floor(Math.random() * colorPalette.length)];
|
||||
html = `<div id="biz-doc-connecteduser-` + unibaseId + `" class="d-flex flex-row border rounded-circle w-35p h-35p biz-doc-users-` + i + `" style="margin-right:-8px; background-color:` + randomColor + `">
|
||||
<div id="biz-doc-connecteduser_` + unibaseId + `" class="biz-doc-connectedusersfirstletter m-auto" data-toggle="popover" data-placement="top" title = "` + this.connecteduserfirstName[i] + `">` + connectedUsersFirstChar[i] + `</div></div>`;
|
||||
if (i <= 5) {
|
||||
$("#biz-doc-connected_users_container").append(html);
|
||||
}
|
||||
usersHtml += '<a class="dropdown-item d-flex flex-row align-items-center p-1 my-1" href="javascript:void(0)"><div class="biz-doc-connectedusersfirstletter border mr-2 px-2 rounded-circle text-white" style="background-color:#' + randomColor + '" title = "' + this.connecteduserfirstName[i] + '">' + connectedUsersFirstChar[i] + '</div><span class="font-13 font-weight-500">' + FileUsers[i].firstName + '</span></a>';
|
||||
if (i > 5) {
|
||||
$("#biz-doc-connected_users_container").children().last().remove();
|
||||
$("#biz-doc-connected_users_container").append('<div class="users-dropdown"><a href="javascript:void(0);" class="d-flex flex-row border rounded-circle w-35p h-35p text-dark biz-doc-users-' + i + '" role="button" id="biz-doc-connecteduser-' + unibaseId + '" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style=" background-color:lightgray;margin-right:-8px"><span class="m-auto font-14 font-weight-500"><span class="font-12 text-muted"><i class="la la-plus"></i></span>' + [i - 4] + '</span></a><div class="dropdown-menu z-index-10 position-absolute bg-white h-275p scroll-bar" aria-labelledby="biz-doc-connecteduser-' + unibaseId + '"></div>');
|
||||
$('.users-dropdown .dropdown-menu').append(usersHtml);
|
||||
}
|
||||
}
|
||||
}
|
||||
renderPopup() {
|
||||
Unibase.Apps.Collaboration.Components.Documents.Instance().loadForm(0, this.FileId, 0, null, this.documentGroup);
|
||||
}
|
||||
renderMenuBar() {
|
||||
let containers = document.body.getElementsByClassName('_bizgaze_popup_container');
|
||||
this.container = containers[containers.length - 1];
|
||||
this.container.insertBefore(this.util.createElement("div", 'class', 'biz-doc-ribbon'), document.body.getElementsByClassName('_bizgaze_popup_container')[0].firstElementChild);
|
||||
this.util.appendChildren('biz-doc-ribbon', 0, this.util.createElement("div", 'class', 'biz-doc-docxlogo'), this.util.createElement("div", 'class', 'biz-doc-tooolbar'), this.util.createElement("div", 'class', 'biz-doc-userdetails'));
|
||||
this.util.appendChildren('biz-doc-docxlogo', 0, this.util.createElement("img", 'class', 'biz-doc-logo'));
|
||||
this.util.appendChildren('biz-doc-tooolbar', 0, this.util.createElement("div", 'class', 'biz-doc-fileinfo'), this.util.createElement("div", 'class', 'biz-doc-fileshare-wrapper'), this.util.createElement("div", 'class', 'biz-doc-onlineusers'), this.util.createElement("div", 'class', 'biz-doc-toolbarmenu'));
|
||||
this.util.appendChildren('biz-doc-fileinfo', 0, this.util.createElement("input", 'class', 'biz-doc-filename'), this.util.createElement('div', 'class', 'biz-doc-starred'), this.util.createElement('div', 'class', 'biz-ss-autosave'));
|
||||
this.util.appendChildren('biz-doc-starred', 0, this.util.createElement("span", 'id', 'biz-doc-star'), this.util.createElement("i", 'class', 'fa fa-star-o text-light font-7 biz_doc_star_icon_' + this.FileId));
|
||||
this.util.appendChildren('biz-ss-autosave', 0, this.util.createElement("img", 'class', 'biz-ss-saveicon biz-ss-cloudsave'), this.util.createElement("img", 'class', 'biz-ss-saveicon biz-ss-cloudoff'), this.util.createElement("div", 'class', 'biz-ss-cloudloading e-icons'), this.util.createElement('div', 'class', 'biz-ss-saving'));
|
||||
this.util.appendChildren('biz-doc-fileshare-wrapper', 0, this.util.createElement("div", 'class', 'biz-doc-fileshare'));
|
||||
this.util.appendChildren('biz-doc-onlineusers', 0, this.util.createElement("div", 'class', 'biz-doc-onlineusersintials d-flex flex-row text-white mx-35 pull-right'));
|
||||
this.util.appendChildren('biz-doc-fileshare', 0, this.util.createElement("button", 'class', 'biz-doc-fileshare-btn'));
|
||||
this.util.appendChildren('biz-doc-userdetails', 0, this.util.createElement("div", 'class', 'biz-doc-userinitial'));
|
||||
this.util.appendChildren('biz-doc-toolbarmenu', 0, this.util.createElement("ul", 'id', 'menu'), this.util.createElement("input", 'class', 'biz-doc-lastedited'));
|
||||
document.getElementsByClassName("biz-doc-ribbon")[0].after(this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar e-toolbar'));
|
||||
this.util.appendChildren('biz-doc-bottomtoolbar', 0, this.util.createElement("div", 'class', 'biz-doc-toolbar-wrapper'));
|
||||
this.util.appendChildren('biz-doc-toolbar-wrapper', 0, this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar-undoredo e-toolbar-items'), this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar-text e-toolbar-items'), this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar-paragraph e-toolbar-items'), this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar-indent e-toolbar-items'));
|
||||
this.userInitial = document.getElementsByClassName("biz-doc-userinitial")[0];
|
||||
let identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
|
||||
if (!identity.photoUrl) {
|
||||
this.userInitial.textContent += identity.name.trim().slice(0, 1);
|
||||
this.userInitial.classList.add('biz-doc-initial-text');
|
||||
}
|
||||
else {
|
||||
this.userInitial.classList.add('biz-doc-initial-img');
|
||||
this.userInitial.style.backgroundImage = "url(" + identity.photoUrl + ")";
|
||||
}
|
||||
document.getElementsByClassName("biz-doc-logo")[0].setAttribute('src', 'imgs/BizgazeDocsIcon.svg');
|
||||
document.getElementsByClassName("biz-ss-cloudsave")[0].setAttribute('src', 'imgs/cloud-computing.svg');
|
||||
document.getElementsByClassName("biz-ss-cloudoff")[0].setAttribute('src', 'imgs/cloud-off.svg');
|
||||
document.getElementsByClassName("biz-ss-cloudoff")[0].style.display = "none";
|
||||
let attributes = {
|
||||
'value': this.FileName,
|
||||
'type': 'text'
|
||||
};
|
||||
document.getElementsByClassName("biz-doc-fileshare-btn")[0].style.backgroundColor = "#049503";
|
||||
var shareBtn = new ej.buttons.Button({ cssClass: `e-primary`, content: `Share`, iconCss: 'biz-doc-fileshare-icon icon-doc-lockopen' });
|
||||
shareBtn.appendTo(".biz-doc-fileshare-btn");
|
||||
document.getElementsByClassName("biz-doc-userinitial")[0].setAttribute("title", identity.name.trim());
|
||||
let color = this.util.colorHash(identity.name.trim());
|
||||
document.getElementsByClassName("biz-doc-userinitial")[0].style.backgroundColor = color.hex;
|
||||
if (!this.newUpload) {
|
||||
debugger;
|
||||
if (this.lastEditedTime != 0) {
|
||||
if (this.unibaseusername === this.username) {
|
||||
let htmlelementlastedited = document.getElementsByClassName('biz-doc-lastedited')[0];
|
||||
this.util.addAttributes(htmlelementlastedited, {
|
||||
'value': 'last edit was made ' + this.lastEditedTime + ' ' + this.timePeriod + ' ago',
|
||||
'type': 'span'
|
||||
});
|
||||
}
|
||||
else {
|
||||
let htmlelementlastedited = document.getElementsByClassName('biz-doc-lastedited')[0];
|
||||
this.util.addAttributes(htmlelementlastedited, {
|
||||
'value': 'last edit was made ' + this.lastEditedTime + ' ' + this.timePeriod + ' ago by ' + this.username,
|
||||
'type': 'span'
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.unibaseusername === this.username) {
|
||||
let htmlelementlastedited = document.getElementsByClassName('biz-doc-lastedited')[0];
|
||||
this.util.addAttributes(htmlelementlastedited, {
|
||||
'value': 'last edit was made seconds ago ',
|
||||
'type': 'span'
|
||||
});
|
||||
}
|
||||
else {
|
||||
let htmlelementlastedited = document.getElementsByClassName('biz-doc-lastedited')[0];
|
||||
this.util.addAttributes(htmlelementlastedited, {
|
||||
'value': 'last edit was made seconds ago by ' + this.username,
|
||||
'type': 'span'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
let htmlelement = document.getElementsByClassName('biz-doc-filename')[0];
|
||||
this.util.addAttributes(htmlelement, attributes);
|
||||
let attributesforautosave = {
|
||||
'type': 'text'
|
||||
};
|
||||
let htmlelementforautosave = document.getElementsByClassName('biz-ss-saving')[0];
|
||||
this.util.addAttributes(htmlelementforautosave, attributesforautosave);
|
||||
document.getElementsByClassName('biz-ss-saving')[0].style.display = 'none';
|
||||
document.getElementsByClassName('biz-doc-lastedited')[0].setAttribute('disabled', "");
|
||||
document.getElementsByClassName('biz-ss-saving')[0].innerText = 'Saving...';
|
||||
this.ribbonElem = document.body.getElementsByClassName('biz-doc-ribbon')[0];
|
||||
}
|
||||
editDetails() {
|
||||
if (this.FileId != 0) {
|
||||
Unibase.Apps.Collaboration.DocumentManager.Instance().lastEdit(this.FileId).then((response) => {
|
||||
this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
|
||||
this.unibaseusername = this.identity.name.trim();
|
||||
this.lastEditedTime = response.result.Lastedittime;
|
||||
this.username = response.result.LastUpdatedByName;
|
||||
this.timePeriod = response.result.TimePeriod;
|
||||
if (this.unibaseusername === this.username && this.lastEditedTime === 0) {
|
||||
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
|
||||
element.value = "last edit was made seconds ago";
|
||||
}
|
||||
else if (this.unibaseusername === this.username && this.lastEditedTime !== 0) {
|
||||
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
|
||||
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
|
||||
}
|
||||
else {
|
||||
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
|
||||
element.value = "last edit was made seconds ago by " + this.username;
|
||||
}
|
||||
});
|
||||
}
|
||||
clearInterval(this.intr);
|
||||
clearInterval(this.intrhour);
|
||||
this.initSetInterval();
|
||||
}
|
||||
convertDocsToPdfDownload(FileId) {
|
||||
Unibase.Apps.Collaboration.DocumentManager.Instance().ConvertDocstoPdfDownload(FileId).then((response) => {
|
||||
Unibase.Themes.Compact.Components.Notification.Instance().Downloadfile(response.result);
|
||||
});
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new Base();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
DocEditor.Base = Base;
|
||||
})(DocEditor = Components.DocEditor || (Components.DocEditor = {}));
|
||||
})(Components = Collaboration.Components || (Collaboration.Components = {}));
|
||||
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
|
||||
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
|
||||
})(Unibase || (Unibase = {}));
|
||||
Исполняемый файл
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
@@ -0,0 +1,832 @@
|
||||
var Unibase;
|
||||
(function (Unibase) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Collaboration;
|
||||
(function (Collaboration) {
|
||||
let Components;
|
||||
(function (Components) {
|
||||
let DocEditor;
|
||||
(function (DocEditor) {
|
||||
class Ribbon {
|
||||
init(docobj, result) {
|
||||
this.FileName = result.FileName;
|
||||
this.FileId = result.FileId;
|
||||
this.documentGroup = result.DocumentGroup;
|
||||
this.wordDocumentObj = docobj;
|
||||
this.docBase = Unibase.Apps.Collaboration.Components.DocEditor.Base.Instance();
|
||||
this.fileDownload = Unibase.Apps.Collaboration.Components.Common.Download.Instance();
|
||||
this.util = Unibase.Apps.Collaboration.Components.Common.Util.Instance();
|
||||
this.render();
|
||||
}
|
||||
render() {
|
||||
this.wordDocumentMenubar(this.FileId, this.documentGroup, this.FileName);
|
||||
this.appendToolbarElements();
|
||||
this.createResponsiveToolbar();
|
||||
this.updateProp();
|
||||
}
|
||||
updateProp() {
|
||||
this.fontSize = document.getElementById("DocumentViewer_editor_font_properties_fontSize").ej2_instances[0];
|
||||
}
|
||||
setFontSize(size) {
|
||||
this.wordDocumentObj.textProperties.text.isRetrieving = false;
|
||||
this.fontSize.value = size;
|
||||
}
|
||||
wordDocumentMenubar(FileId, documentGroup, FileName) {
|
||||
var instance = this;
|
||||
var menuItems = [
|
||||
{
|
||||
text: 'File',
|
||||
items: [
|
||||
{ text: 'New', iconCss: 'e-icons add-new' },
|
||||
{ text: 'Open', iconCss: 'e-icons e-open' },
|
||||
{ text: 'Make a copy', iconCss: 'e-icons biz_make_a_copy' },
|
||||
{
|
||||
text: 'Download', iconCss: 'e-icons e-save',
|
||||
items: [
|
||||
{ text: 'Microsoft Word Document (.docx)', iconCss: 'e-icons' },
|
||||
{ text: 'Portable Document Format (.pdf)', iconCss: 'e-icons Pdf_Export' },
|
||||
{ text: 'Text Document (.txt)', iconCss: 'e-icons' }
|
||||
]
|
||||
},
|
||||
{ text: 'Close', iconCss: 'e-icons cross-close' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Edit',
|
||||
items: [
|
||||
{ text: 'Undo', iconCss: 'e-icons biz-doc-undo-icon' },
|
||||
{ text: 'Redo', iconCss: 'e-icons biz-doc-redo-icon' },
|
||||
{ separator: true },
|
||||
{ text: 'Cut', iconCss: 'e-icons biz-doc-cut-icon' },
|
||||
{ text: 'Copy', iconCss: 'e-icons biz-doc-copy-icon' },
|
||||
{ text: 'Paste', iconCss: 'e-icons biz-doc-paste-icon' },
|
||||
{
|
||||
text: 'Special paste', iconCss: 'e-icons biz-doc-paste-icon', items: [
|
||||
{ text: "Keep source formatting", iconCss: 'e-icons MT_PasteStyle' },
|
||||
{ text: "Match destination formatting", iconCss: 'e-icons M_MergeFormatting' },
|
||||
{ text: "Text only", iconCss: 'e-icons MT_PasteTextonly' },
|
||||
]
|
||||
},
|
||||
{ separator: true },
|
||||
{ text: 'Delete', iconCss: 'e-icons MT_Delete' },
|
||||
{ text: 'Select all', iconCss: 'e-icons MT_SelectAll' },
|
||||
{ text: 'Search', iconCss: 'e-icons MT_Search' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'View',
|
||||
items: [
|
||||
{ text: 'Page Setup', iconCss: 'e-icons M_PageSetup' },
|
||||
{ text: 'Page Number', iconCss: 'e-icons M_PageNumber' },
|
||||
{
|
||||
text: 'Mode', iconCss: 'e-icons MT_Preview',
|
||||
items: [
|
||||
{ text: 'Editing', iconCss: 'e-icons biz_edit_icon' },
|
||||
{ text: 'View only', iconCss: 'e-icons MT_Preview' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Break', iconCss: 'e-icons M_Break',
|
||||
items: [
|
||||
{ text: 'Page Break', iconCss: 'e-icons M_PageBreak' },
|
||||
{ text: 'Section Break', iconCss: 'e-icons M_SectionBreak' },
|
||||
]
|
||||
},
|
||||
{ separator: true },
|
||||
{ text: 'Full screen', iconCss: 'e-icons biz-enterfullscreen' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Insert',
|
||||
items: [
|
||||
{ text: 'Header', iconCss: 'e-icons M_Header' },
|
||||
{ text: 'Footer', iconCss: 'e-icons M_Footer' },
|
||||
{ separator: true },
|
||||
{ text: 'Image', iconCss: 'e-icons B_Image' },
|
||||
{ text: 'Table', iconCss: 'e-icons table-02' },
|
||||
{ text: 'Link', iconCss: 'e-icons e-Hyperlink' },
|
||||
{ text: 'Bookmark', iconCss: 'e-icons M_Bookmark' },
|
||||
{ text: 'Table Of Contents', iconCss: 'e-icons M_TableOfContent' },
|
||||
{ separator: true },
|
||||
{ text: 'Footnote', iconCss: 'e-icons M_Footnote' },
|
||||
{ text: 'Endnote', iconCss: 'e-icons M_Endnote' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Format',
|
||||
items: [
|
||||
{
|
||||
text: 'Text', iconCss: 'e-icons ',
|
||||
items: [
|
||||
{ text: 'Bold', iconCss: 'e-icons ' },
|
||||
{ text: 'Italic', iconCss: 'e-icons ' },
|
||||
{ text: 'Underline', iconCss: 'e-icons ' },
|
||||
{ text: 'Strikethrough', iconCss: 'e-icons ' },
|
||||
{ text: 'Superscript', iconCss: 'e-icons ' },
|
||||
{ text: 'Subscript', iconCss: 'e-icons ' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Font size', iconCss: 'e-icons ',
|
||||
items: [
|
||||
{ text: '8', iconCss: 'e-icons ' },
|
||||
{ text: '9', iconCss: 'e-icons ' },
|
||||
{ text: '10', iconCss: 'e-icons ' },
|
||||
{ text: '11', iconCss: 'e-icons ' },
|
||||
{ text: '12', iconCss: 'e-icons ' },
|
||||
{ text: '14', iconCss: 'e-icons ' },
|
||||
{ text: '16', iconCss: 'e-icons ' },
|
||||
{ text: '18', iconCss: 'e-icons ' },
|
||||
{ text: '20', iconCss: 'e-icons ' },
|
||||
{ text: '22', iconCss: 'e-icons ' },
|
||||
{ text: '24', iconCss: 'e-icons ' },
|
||||
{ text: '26', iconCss: 'e-icons ' },
|
||||
{ text: '28', iconCss: 'e-icons ' },
|
||||
{ text: '36', iconCss: 'e-icons ' },
|
||||
{ text: '48', iconCss: 'e-icons ' },
|
||||
{ text: '72', iconCss: 'e-icons ' },
|
||||
{ text: '96', iconCss: 'e-icons ' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Paragraph styles', iconCss: 'e-icons ',
|
||||
items: [
|
||||
{ text: 'Normal', iconCss: 'e-icons ' },
|
||||
{ text: 'Heading 1', iconCss: 'e-icons ' },
|
||||
{ text: 'Heading 2', iconCss: 'e-icons ' },
|
||||
{ text: 'Heading 3', iconCss: 'e-icons ' },
|
||||
{ text: 'Heading 4', iconCss: 'e-icons ' },
|
||||
{ text: 'Heading 5', iconCss: 'e-icons ' },
|
||||
{ text: 'Heading 6', iconCss: 'e-icons ' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Align & indent', iconCss: 'e-icons ',
|
||||
items: [
|
||||
{ text: 'Left', iconCss: 'e-icons ' },
|
||||
{ text: 'Center', iconCss: 'e-icons ' },
|
||||
{ text: 'Right', iconCss: 'e-icons ' },
|
||||
{ text: 'Justified', iconCss: 'e-icons ' },
|
||||
{ separator: true },
|
||||
{ text: 'Increase indent', iconCss: 'e-icons ' },
|
||||
{ text: 'Decrease indent', iconCss: 'e-icons ' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Line spacing', iconCss: 'e-icons ',
|
||||
items: [
|
||||
{ text: 'Single' },
|
||||
{ text: '1.15' },
|
||||
{ text: '1.5' },
|
||||
{ text: 'Double' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Bulletes & numbering', iconCss: 'e-icons ', items: [
|
||||
{
|
||||
text: 'Bullets',
|
||||
items: [
|
||||
{ text: 'None' },
|
||||
{ text: 'Bullet dot' },
|
||||
{ text: 'Bullet circle' },
|
||||
{ text: 'Bullet square' },
|
||||
{ text: 'Bullet flower' },
|
||||
{ text: 'Bullet arrow' },
|
||||
{ text: 'Bullet tick' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Numbering', items: [
|
||||
{ text: 'No numbering' },
|
||||
{ text: 'Numbers' },
|
||||
{ text: 'Lower case' },
|
||||
{ text: 'Upper case' },
|
||||
{ text: 'roman' },
|
||||
{ text: 'roman two' },
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
{ separator: true },
|
||||
{ text: 'Clear formatting', iconCss: 'e-icons ' },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Tools',
|
||||
items: [
|
||||
{ text: 'Comments', iconCss: 'e-icons AddComment' },
|
||||
{ text: 'Track Changes', iconCss: 'e-icons M_TrackChanges' },
|
||||
{ text: 'Local ClipBoard', iconCss: 'e-icons MT_Paste' },
|
||||
{ text: 'Restrict Editing', iconCss: 'e-icons M_Lock', items: [{ text: "Read Only" }, { text: "Protections" }] },
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Add-ons',
|
||||
items: [
|
||||
{
|
||||
text: 'Form Fields', iconCss: 'e-icons M_FormField', items: [{ text: "Text Form", iconCss: 'e-icons M_Textform' },
|
||||
{ text: "Check Box", iconCss: 'e-icons M_CheckBox' }, { text: "Drop-Down", iconCss: 'e-icons M_Dropdown' }]
|
||||
},
|
||||
{ text: 'Update Fields', iconCss: 'e-icons M_UpdateField' },
|
||||
]
|
||||
}
|
||||
];
|
||||
if (!this.wordDocumentMenubarObj) {
|
||||
let menubaritems = ["File", "Edit", "View", "Insert", "Format", "Tools", "Add-ons"];
|
||||
this.wordDocumentMenubarObj = new ej.navigations.Menu({
|
||||
cssClass: 'biz-doc-menu',
|
||||
showItemOnClick: true,
|
||||
beforeItemRender: (e) => {
|
||||
let popupitems = ["Text", "Font size", "Paragraph styles", "Align & indent", "Line spacing",
|
||||
"Bullets & numbering", "Bold", "Italic", "Underline", "Strikethrough", "Superscript",
|
||||
"Subscript", "Normal", "Heading 1", "Heading 2", "Heading 3", "Heading 4", "Heading 5",
|
||||
"Heading 6", "8", "9", "10", "11", "12", "16", "14", "18", "20", "22", "24", "26", "48", "28", "36", "72", "96"];
|
||||
if (popupitems.includes(e.item.text)) {
|
||||
if (this.docBase.formatInfo && this.docBase.formatInfo.element && this.docBase.formatInfo.element.characterFormat) {
|
||||
(this.docBase.formatInfo.element.characterFormat.bold) && (e.item.text == "Bold") && (this.addOrRemoveSelectIcon(e));
|
||||
(this.docBase.formatInfo.element.characterFormat.italic) && (e.item.text == "Italic") && (this.addOrRemoveSelectIcon(e));
|
||||
(this.docBase.formatInfo.element.characterFormat.baselineAlignment == e.item.text) && (this.addOrRemoveSelectIcon(e));
|
||||
(e.item.text == "Underline") && (this.docBase.formatInfo.element.characterFormat.underline == "Single") && (this.addOrRemoveSelectIcon(e));
|
||||
(e.item.text == "Strikethrough") && (this.docBase.formatInfo.element.characterFormat.strikethrough == "SingleStrike") && (this.addOrRemoveSelectIcon(e));
|
||||
(e.item.text == "Text") && ((this.docBase.formatInfo.element.characterFormat.bold) || (this.docBase.formatInfo.element.characterFormat.italic) ||
|
||||
(this.docBase.formatInfo.element.characterFormat.baselineAlignment == e.item.text) ||
|
||||
(this.docBase.formatInfo.element.characterFormat.underline == "Single") ||
|
||||
(this.docBase.formatInfo.element.characterFormat.strikethrough == "SingleStrike")) && (this.addOrRemoveSelectIcon(e));
|
||||
(this.docBase.formatInfo.element.characterFormat.fontSize == e.item.text) && (this.addOrRemoveSelectIcon(e));
|
||||
if (this.docBase.formatInfo.element.characterFormat.baseCharStyle) {
|
||||
((this.docBase.formatInfo.element.characterFormat.baseCharStyle.name).slice(0, -5) == e.item.text) && (this.addOrRemoveSelectIcon(e));
|
||||
}
|
||||
else {
|
||||
(e.item.text == "Normal") && (this.addOrRemoveSelectIcon(e));
|
||||
}
|
||||
(e.item.text == "Paragraph styles") && (this.addOrRemoveSelectIcon(e));
|
||||
var fontsizes = ["8", "9", "10", "11", "12", "16", "14", "18", "20", "22", "24", "26", "48", "28", "36", "72", "96"];
|
||||
(e.item.text == "Font size") && (fontsizes.includes(this.docBase.formatInfo.element.characterFormat.fontSize.toString())) && (this.addOrRemoveSelectIcon(e));
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeClose: e => {
|
||||
if (menubaritems.indexOf(e.parentItem.text) > -1) {
|
||||
this.wordDocumentMenubarObj.showItemOnClick = true;
|
||||
}
|
||||
},
|
||||
beforeOpen: (e) => {
|
||||
if (menubaritems.indexOf(e.parentItem.text) > -1) {
|
||||
this.wordDocumentMenubarObj.showItemOnClick = false;
|
||||
}
|
||||
let editItems = ["Undo", "Redo", "Paste", "Special paste"];
|
||||
if (e.items.find(x => x.text == "Undo") != null) {
|
||||
let undoOverley = document.getElementById("DocumentViewer_toolbar_undo").parentElement.classList.contains("e-overlay");
|
||||
if (undoOverley) {
|
||||
this.wordDocumentMenubarObj.enableItems(["Undo"], false);
|
||||
}
|
||||
}
|
||||
if (e.items.find(x => x.text == "Redo") != null) {
|
||||
let redoOverley = document.getElementById("DocumentViewer_toolbar_redo").parentElement.classList.contains("e-overlay");
|
||||
if (redoOverley) {
|
||||
this.wordDocumentMenubarObj.enableItems(["Redo"], false);
|
||||
}
|
||||
}
|
||||
},
|
||||
select: (e) => {
|
||||
var lineHeight = document.getElementById("DocumentViewer_editor_font_properties_lineHeight").ej2_instances[0];
|
||||
var bullets = document.getElementById("DocumentViewer_editor_font_properties_bullet_dropdownbtn").ej2_instances[0];
|
||||
console.log(e);
|
||||
switch (e.item.text) {
|
||||
case "New":
|
||||
this.processNewWord();
|
||||
break;
|
||||
case "Microsoft Word Document (.docx)":
|
||||
this.fileDownload.downloadDocumentFile(FileId, documentGroup, FileName, 'Docx', instance.docBase.documentContainer);
|
||||
break;
|
||||
case "Portable Document Format (.pdf)":
|
||||
this.docBase.convertDocsToPdfDownload(FileId);
|
||||
break;
|
||||
case "Text Document (.txt)":
|
||||
this.fileDownload.downloadDocumentFile(FileId, documentGroup, FileName, 'Txt', instance.docBase.documentContainer);
|
||||
break;
|
||||
case "Open":
|
||||
this.renderOpenNewDialogue();
|
||||
break;
|
||||
case "Close":
|
||||
this.closePopup();
|
||||
break;
|
||||
case "Undo":
|
||||
document.getElementById("DocumentViewer_toolbar_undo").click();
|
||||
break;
|
||||
case "Redo":
|
||||
document.getElementById("DocumentViewer_toolbar_redo").click();
|
||||
break;
|
||||
case "Cut":
|
||||
this.docBase.wordDocumentObj.documentEditor.editor.cut();
|
||||
break;
|
||||
case "Copy":
|
||||
this.docBase.wordDocumentObj.documentEditor.selection.copy();
|
||||
break;
|
||||
case "Paste":
|
||||
this.docBase.wordDocumentObj.documentEditor.editor.paste();
|
||||
break;
|
||||
case "Match destination formatting":
|
||||
this.closePopup();
|
||||
break;
|
||||
case "Text only":
|
||||
this.closePopup();
|
||||
break;
|
||||
case "Keep source formatting":
|
||||
this.closePopup();
|
||||
break;
|
||||
case "Delete":
|
||||
this.docBase.wordDocumentObj.documentEditor.editor.delete();
|
||||
break;
|
||||
case "Select all":
|
||||
this.docBase.wordDocumentObj.documentEditor.selection.selectAll();
|
||||
break;
|
||||
case "Search":
|
||||
this.docBase.wordDocumentObj.documentEditor.showOptionsPane();
|
||||
break;
|
||||
case "View only":
|
||||
this.docBase.wordDocumentObj.documentEditor.isReadOnly = true;
|
||||
break;
|
||||
case "Editing":
|
||||
this.docBase.wordDocumentObj.documentEditor.isReadOnly = false;
|
||||
break;
|
||||
case "Header":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_header" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
case "Footer":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_footer" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
case "Page Setup":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_page_setup" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
case "Page Number":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_page_number" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
case "Page Break":
|
||||
this.wordDocumentObj.toolbarModule.container.documentEditor.editorModule.insertPageBreak();
|
||||
break;
|
||||
case "Section Break":
|
||||
this.wordDocumentObj.toolbarModule.container.documentEditor.editorModule.insertSectionBreak();
|
||||
break;
|
||||
case "Footnote":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_footnote" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
case "Endnote":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_endnote" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
case "Full screen":
|
||||
Unibase.Apps.Collaboration.Components.Fullscreen.Instance().refreshWordDocumentHeight(this.wordDocumentObj);
|
||||
break;
|
||||
case "Image":
|
||||
this.wordDocumentObj.toolbarModule.imagePicker.value = "";
|
||||
this.wordDocumentObj.toolbarModule.imagePicker.click();
|
||||
setTimeout(() => { this.wordDocumentObj.toolbarModule.documentEditor.focusIn(); }, 30);
|
||||
break;
|
||||
case "Table":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_table" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
case "Link":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_link" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
case "Bookmark":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_bookmark" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
case "Table Of Contents":
|
||||
this.wordDocumentObj.documentEditor.showDialog('TableOfContents');
|
||||
break;
|
||||
case "Bold":
|
||||
document.getElementById("DocumentViewer_editor_font_properties_bold").click();
|
||||
break;
|
||||
case "Italic":
|
||||
document.getElementById("DocumentViewer_editor_font_properties_italic").click();
|
||||
break;
|
||||
case "Underline":
|
||||
document.getElementById("DocumentViewer_editor_font_properties_underline").click();
|
||||
break;
|
||||
case "Strikethrough":
|
||||
document.getElementById("DocumentViewer_editor_font_properties_strikethrough").click();
|
||||
break;
|
||||
case "Superscript":
|
||||
document.getElementById("DocumentViewer_editor_font_properties_superscript").click();
|
||||
break;
|
||||
case "Subscript":
|
||||
document.getElementById("DocumentViewer_editor_font_properties_subscript").click();
|
||||
break;
|
||||
case "Clear formatting":
|
||||
document.getElementById("DocumentViewer_editor_font_properties_clearFormat").click();
|
||||
break;
|
||||
case "Left":
|
||||
document.getElementById("DocumentViewer_editor_font_properties_leftIndent").click();
|
||||
break;
|
||||
case "Center":
|
||||
document.getElementById("DocumentViewer_editor_font_properties_centerIndent").click();
|
||||
break;
|
||||
case "Right":
|
||||
document.getElementById("DocumentViewer_editor_font_properties_rightIndent").click();
|
||||
break;
|
||||
case "Justified":
|
||||
document.getElementById("DocumentViewer_editor_font_properties_justify").click();
|
||||
break;
|
||||
case "Increase indent":
|
||||
document.getElementById("DocumentViewer_editor_font_properties_increaseIndent").click();
|
||||
break;
|
||||
case "Decrease indent":
|
||||
document.getElementById("DocumentViewer_editor_font_properties_decreaseIndent").click();
|
||||
break;
|
||||
case "Single":
|
||||
lineHeight.trigger('select', { item: lineHeight.items[0] });
|
||||
break;
|
||||
case "1.15":
|
||||
lineHeight.trigger('select', { item: lineHeight.items[1] });
|
||||
break;
|
||||
case "1.5":
|
||||
lineHeight.trigger('select', { item: lineHeight.items[2] });
|
||||
break;
|
||||
case "Double":
|
||||
lineHeight.trigger('select', { item: lineHeight.items[3] });
|
||||
break;
|
||||
case "None":
|
||||
this.wordDocumentObj.textProperties.paragraph.numberedNoneClick();
|
||||
break;
|
||||
case "Bullet dot":
|
||||
this.wordDocumentObj.textProperties.paragraph.bulletDotClick();
|
||||
break;
|
||||
case "Bullet circle":
|
||||
this.wordDocumentObj.textProperties.paragraph.bulletCircleClick();
|
||||
break;
|
||||
case "Bullet square":
|
||||
this.wordDocumentObj.textProperties.paragraph.bulletSquareClick();
|
||||
break;
|
||||
case "Bullet flower":
|
||||
this.wordDocumentObj.textProperties.paragraph.bulletFlowerClick();
|
||||
break;
|
||||
case "Bullet arrow":
|
||||
this.wordDocumentObj.textProperties.paragraph.bulletArrowClick();
|
||||
break;
|
||||
case "Bullet tick":
|
||||
this.wordDocumentObj.textProperties.paragraph.bulletTickClick();
|
||||
break;
|
||||
case "Numbers":
|
||||
this.wordDocumentObj.textProperties.paragraph.numberedNumberDotClick();
|
||||
break;
|
||||
case "Lower case":
|
||||
this.wordDocumentObj.textProperties.paragraph.numberedLowLetterClick();
|
||||
break;
|
||||
case "Upper case":
|
||||
this.wordDocumentObj.textProperties.paragraph.numberedUpLetterClick();
|
||||
break;
|
||||
case "roman":
|
||||
this.wordDocumentObj.textProperties.paragraph.numberedLowRomanClick();
|
||||
break;
|
||||
case "roman two":
|
||||
this.wordDocumentObj.textProperties.paragraph.numberedUpRomanClick();
|
||||
break;
|
||||
case "No numbering":
|
||||
this.wordDocumentObj.textProperties.paragraph.numberedNoneClick();
|
||||
break;
|
||||
case "Normal":
|
||||
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Normal', true);
|
||||
break;
|
||||
case "Heading 1":
|
||||
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Heading 1', true);
|
||||
break;
|
||||
case "Heading 2":
|
||||
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Heading 2', true);
|
||||
break;
|
||||
case "Heading 3":
|
||||
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Heading 3', true);
|
||||
break;
|
||||
case "Heading 4":
|
||||
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Heading 4', true);
|
||||
break;
|
||||
case "Heading 5":
|
||||
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Heading 5', true);
|
||||
break;
|
||||
case "Heading 6":
|
||||
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Heading 6', true);
|
||||
break;
|
||||
case "8":
|
||||
this.setFontSize('8');
|
||||
break;
|
||||
case "9":
|
||||
this.setFontSize('9');
|
||||
break;
|
||||
case "10":
|
||||
this.setFontSize('10');
|
||||
break;
|
||||
case "11":
|
||||
this.setFontSize('11');
|
||||
break;
|
||||
case "12":
|
||||
this.setFontSize('12');
|
||||
break;
|
||||
case "14":
|
||||
this.setFontSize('14');
|
||||
break;
|
||||
case "16":
|
||||
this.setFontSize('16');
|
||||
break;
|
||||
case "18":
|
||||
this.setFontSize('18');
|
||||
break;
|
||||
case "20":
|
||||
this.setFontSize('20');
|
||||
break;
|
||||
case "22":
|
||||
this.setFontSize('22');
|
||||
break;
|
||||
case "24":
|
||||
this.setFontSize('24');
|
||||
break;
|
||||
case "36":
|
||||
this.setFontSize('36');
|
||||
break;
|
||||
case "Find":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_find" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
case "Comments":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_comment" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
case "Track Changes":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_track" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
case "Local ClipBoard":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_use_local_clipboard" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
case "Read Only":
|
||||
var ele = $('li[aria-label="Read Only"]').children('span').toggleClass('Selection');
|
||||
const value = 12;
|
||||
this.wordDocumentObj.toolbarModule.toggleEditing();
|
||||
break;
|
||||
case "Protections":
|
||||
this.wordDocumentObj.toolbarModule.documentEditor.documentHelper.restrictEditingPane.showHideRestrictPane(true);
|
||||
break;
|
||||
case "Text Form":
|
||||
this.wordDocumentObj.toolbarModule.documentEditor.editor.insertFormField('Text');
|
||||
break;
|
||||
case "Check Box":
|
||||
this.wordDocumentObj.toolbarModule.documentEditor.editor.insertFormField('CheckBox');
|
||||
break;
|
||||
case "Drop-Down":
|
||||
this.wordDocumentObj.toolbarModule.documentEditor.editor.insertFormField('DropDown');
|
||||
break;
|
||||
case "Update Fields":
|
||||
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_update_fields" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
|
||||
break;
|
||||
}
|
||||
},
|
||||
items: menuItems,
|
||||
}, '#menu');
|
||||
}
|
||||
}
|
||||
addOrRemoveSelectIcon(ele) {
|
||||
if (!ele.element.firstElementChild.classList.contains("biz-ss-selecticon")) {
|
||||
ele.element.firstElementChild.classList.add("biz-ss-selecticon");
|
||||
}
|
||||
}
|
||||
processNewWord() {
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/collaboration/components/common/util.js", () => {
|
||||
let urlStr = Unibase.Apps.Collaboration.Components.Common.Util.Instance().makeid(40);
|
||||
window.open(window.origin + "#/documents/" + urlStr + "/newword/0");
|
||||
});
|
||||
}
|
||||
renderOpenNewDialogue() {
|
||||
this.OpenSelectButton = new ej.buttons.Button({ cssClass: `e-flat` });
|
||||
this.OpenCancelButton = new ej.buttons.Button({ cssClass: `e-flat` });
|
||||
var elem = document.getElementById("opendocfile");
|
||||
if (elem == null) {
|
||||
this.docOpenDialougObj = new ej.popups.Dialog({
|
||||
isModal: true,
|
||||
header: 'Open File',
|
||||
content: `<div id='tabobjforopendoc'></div>`,
|
||||
target: document.getElementById("container"),
|
||||
width: '470px',
|
||||
height: '330px',
|
||||
animationSettings: { effect: 'Zoom' },
|
||||
cssClass: "biz-doc-importopen-dialog"
|
||||
});
|
||||
this.docOpenDialougObj.appendTo('#dialog');
|
||||
var tabObjForOpen = new ej.navigations.Tab({
|
||||
items: [{
|
||||
header: { 'text': 'Upload' },
|
||||
content: `<div id="opendocfile-wrapper">
|
||||
<h2 style="color: #ccc">Drag a file...</h2>
|
||||
<label id='opendocfilelable'>
|
||||
select file from device
|
||||
<br>
|
||||
<input type="file" name="" id="opendocfile" accept=".doc, .docx, .txt , .rtf" placeholder="select a file from your device" >
|
||||
</label>
|
||||
<div id="filename"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<button id='opendocfile-select-btn' class='e-disabled'>select</button>
|
||||
<button id='opendocfile-cancel-btn'>cancel</button>`
|
||||
}]
|
||||
});
|
||||
tabObjForOpen.appendTo('#tabobjforopendoc');
|
||||
}
|
||||
else {
|
||||
this.docOpenDialougObj.show();
|
||||
}
|
||||
this.importOpenDialogcreated();
|
||||
}
|
||||
importOpenDialogcreated() {
|
||||
document.getElementById('opendocfile-select-btn').setAttribute("disabled", 'true');
|
||||
document.getElementById('opendocfile-select-btn').addEventListener('click', () => {
|
||||
this.openWordDocument();
|
||||
this.docOpenDialougObj.hide();
|
||||
});
|
||||
document.getElementById('opendocfile-cancel-btn').addEventListener('click', () => {
|
||||
this.docOpenDialougObj.hide();
|
||||
document.getElementById('opendocfile-select-btn').classList.add('e-disabled');
|
||||
document.getElementById('filename').innerHTML = "";
|
||||
this.importedFile.value = null;
|
||||
if (this.docOpenDialougObj) {
|
||||
this.docOpenDialougObj.destroy();
|
||||
}
|
||||
});
|
||||
this.OpenSelectButton.appendTo('#opendocfile-select-btn');
|
||||
this.OpenCancelButton.appendTo('#opendocfile-cancel-btn');
|
||||
document.body.addEventListener('dragover', (e) => {
|
||||
e.preventDefault();
|
||||
});
|
||||
document.getElementsByClassName('biz-doc-importopen-dialog')[0].addEventListener('dragover', (e) => {
|
||||
e.preventDefault();
|
||||
});
|
||||
document.getElementsByClassName('biz-doc-importopen-dialog')[0].addEventListener("drop", (e) => {
|
||||
e.preventDefault();
|
||||
document.getElementById('opendocfile').files = e.dataTransfer.files;
|
||||
var ele = { target: { files: e.dataTransfer.files } };
|
||||
this.fileSelected(ele);
|
||||
});
|
||||
document.getElementById('opendocfile').addEventListener('change', (e) => {
|
||||
debugger;
|
||||
this.fileSelected(e);
|
||||
});
|
||||
}
|
||||
fileSelected(e) {
|
||||
document.getElementById('opendocfile-select-btn').removeAttribute('disabled');
|
||||
document.getElementById('opendocfile-select-btn').classList.remove('e-disabled');
|
||||
this.importedFile = document.getElementById('opendocfile');
|
||||
document.getElementById('filename').innerHTML = this.importedFile.files[0].name;
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/core/helpers/file/filehelper.js', () => {
|
||||
Unibase.Platform.Helpers.FileHelper.Instance().getBase64(e).then((response) => {
|
||||
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length != 0) {
|
||||
var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
|
||||
var refId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_recordid").Value);
|
||||
if (refId != 0 && refId != null && refId != undefined) {
|
||||
}
|
||||
}
|
||||
var fileobject = {
|
||||
filedata: response.FileData,
|
||||
filename: response.FileName,
|
||||
filetype: response.FileType,
|
||||
RefId: refId,
|
||||
FileId: this.FileId,
|
||||
};
|
||||
this.documentOpenFileData = fileobject;
|
||||
});
|
||||
});
|
||||
}
|
||||
openWordDocument() {
|
||||
Unibase.Apps.Collaboration.DocumentManager.Instance().importCreateSpreadSheet(this.documentOpenFileData).then((response) => {
|
||||
var result = response.result;
|
||||
});
|
||||
}
|
||||
closePopup() {
|
||||
if (!this.docBase.NewDocument) {
|
||||
Unibase.Apps.Collaboration.Components.DocConnector.Instance().closeDoc();
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
appendToolbarElements() {
|
||||
let sideBarElementsText = [];
|
||||
let sideBarElementsIndent = [];
|
||||
let sideBarElementsParagraph = [];
|
||||
var idsText = ['DocumentViewer_editor_font_properties_fontFamilyDiv', 'DocumentViewer_editor_font_properties_fontSizeDiv', 'DocumentViewer_editor_font_properties_leftDiv',
|
||||
'DocumentViewer_editor_font_properties_rightDiv'];
|
||||
let idsParagraph = ['DocumentViewer_editor_font_properties_color', 'DocumentViewer_editor_font_properties_styleDiv'];
|
||||
var idsIndent = ['DocumentViewer_editor_font_properties_leftIndent', 'DocumentViewer_editor_font_properties_centerIndent', 'DocumentViewer_editor_font_properties_rightIndent', 'DocumentViewer_editor_font_properties_justify',
|
||||
'DocumentViewer_editor_font_properties_decreaseIndent', 'DocumentViewer_editor_font_properties_increaseIndent', 'DocumentViewer_editor_font_properties_lineHeight',
|
||||
'DocumentViewer_editor_font_properties_listDropDiv'];
|
||||
idsText.forEach(element => {
|
||||
sideBarElementsText.push(document.getElementById(element));
|
||||
});
|
||||
idsIndent.forEach(element => {
|
||||
sideBarElementsIndent.push(document.getElementById(element));
|
||||
});
|
||||
idsParagraph.forEach(element => {
|
||||
sideBarElementsParagraph.push(document.getElementById(element));
|
||||
});
|
||||
sideBarElementsText.forEach(element => {
|
||||
this.util.appendChildren('biz-doc-bottomtoolbar-text', 0, element);
|
||||
});
|
||||
sideBarElementsIndent.forEach(element => {
|
||||
this.util.appendChildren('biz-doc-bottomtoolbar-indent', 0, element);
|
||||
});
|
||||
sideBarElementsParagraph.forEach(element => {
|
||||
this.util.appendChildren('biz-doc-bottomtoolbar-paragraph', 0, element);
|
||||
});
|
||||
this.docBase.bottomtoolbartext = document.getElementsByClassName('biz-doc-bottomtoolbar-text')[0];
|
||||
this.util.appendChildren('biz-doc-bottomtoolbar-undoredo', 0, this.util.createElement("button", 'class', 'biz-doc-undo e-disabled e-btn e-lib'));
|
||||
this.util.appendChildren('biz-doc-undo', 0, this.util.createElement("span", 'class', 'e-icons e-icon-left biz-doc-undo-icon e-btn-icon'));
|
||||
this.util.appendChildren('biz-doc-bottomtoolbar-undoredo', 0, this.util.createElement("button", 'class', 'biz-doc-redo e-disabled e-btn e-lib'));
|
||||
this.util.appendChildren('biz-doc-redo', 0, this.util.createElement("span", 'class', 'e-icons e-icon-left biz-doc-redo-icon e-btn-icon'));
|
||||
document.getElementsByClassName("biz-doc-undo")[0].id = "biz_doc_undobtn";
|
||||
document.getElementsByClassName("biz-doc-redo")[0].id = "biz_doc_redobtn";
|
||||
this.docBase.bottomtoolbartext.insertBefore(this.util.createElement('div', 'class', 'biz-doc-toobarspace'), document.getElementsByClassName('biz-doc-bottomtoolbar-text')[0].childNodes[0]);
|
||||
this.docBase.bottomtoolbartext.insertBefore(this.util.createElement('div', 'class', 'biz-doc-toobarspace'), document.getElementsByClassName('biz-doc-bottomtoolbar-text')[0].childNodes[2]);
|
||||
document.getElementsByClassName('biz-doc-bottomtoolbar-indent')[0].insertBefore(this.util.createElement('div', 'class', 'biz-doc-toobarspace'), document.getElementsByClassName('biz-doc-bottomtoolbar-indent')[0].childNodes[0]);
|
||||
document.getElementById('biz_doc_undobtn').insertBefore(this.util.createElement('div', 'class', 'biz-doc-toobarspace'), document.getElementById('biz_doc_undobtn').childNodes[0]);
|
||||
document.getElementById('DocumentViewer_editor_font_properties_increaseIndent').after(this.util.createElement('div', 'class', 'biz-doc-toobarspace'));
|
||||
document.getElementById('DocumentViewer_editor_font_properties_clearFormat').after(this.util.createElement('div', 'class', 'biz-doc-toobarspace'));
|
||||
document.getElementById('DocumentViewer_editor_font_properties_fontSizeDiv').after(this.util.createElement('div', 'class', 'e-toolbar-item e-separator biz-doc-seperator'));
|
||||
document.getElementById('DocumentViewer_editor_font_properties_rightDiv').after(this.util.createElement('div', 'class', 'e-toolbar-item e-separator biz-doc-seperator'));
|
||||
document.getElementById('DocumentViewer_editor_font_properties_styleDiv').after(this.util.createElement('div', 'class', 'e-toolbar-item e-separator biz-doc-seperator'));
|
||||
document.getElementById('DocumentViewer_editor_font_properties_lineHeight').after(this.util.createElement('div', 'class', 'e-toolbar-item e-separator biz-doc-seperator'));
|
||||
document.getElementById('DocumentViewer_editor_font_properties_color').getElementsByClassName("e-colorpicker-wrapper")[0].after(this.util.createElement('div', 'class', 'e-toolbar-item e-separator biz-doc-seperator'));
|
||||
this.util.appendChildren('biz-doc-bottomtoolbar-undoredo', 0, this.util.createElement("button", 'class', 'biz-doc-undo e-disabled e-btn e-lib'));
|
||||
this.util.appendChildren('biz-doc-undo', 0, this.util.createElement("span", 'class', 'e-icons e-icon-left biz-doc-undo-icon e-btn-icon'));
|
||||
this.util.appendChildren('biz-doc-bottomtoolbar-undoredo', 0, this.util.createElement("button", 'class', 'biz-doc-redo e-disabled e-btn e-lib'));
|
||||
this.util.appendChildren('biz-doc-redo', 0, this.util.createElement("span", 'class', 'e-icons e-icon-left biz-doc-redo-icon e-btn-icon'));
|
||||
this.docBase.toolbarWidth = document.querySelector('.biz-doc-bottomtoolbar-undoredo').getBoundingClientRect().width + document.querySelector('.biz-doc-bottomtoolbar-text').getBoundingClientRect().width + document.querySelector('.biz-doc-bottomtoolbar-paragraph').getBoundingClientRect().width + document.querySelector('.biz-doc-bottomtoolbar-indent').getBoundingClientRect().width;
|
||||
}
|
||||
createResponsiveToolbar() {
|
||||
var instance = this;
|
||||
document.getElementsByClassName('biz-doc-bottomtoolbar')[0].insertBefore(this.util.createElement('div', 'class', 'leftarrow-wrapper'), document.getElementsByClassName('biz-doc-bottomtoolbar')[0].childNodes[0]);
|
||||
document.getElementsByClassName('biz-doc-bottomtoolbar')[0].appendChild(this.util.createElement('div', 'class', 'rightarrow-wrapper'));
|
||||
document.getElementsByClassName('leftarrow-wrapper')[0].appendChild(this.util.createElement('button', 'id', 'leftarrow-btn'));
|
||||
document.getElementsByClassName('rightarrow-wrapper')[0].appendChild(this.util.createElement('button', 'id', 'rightarrow-btn'));
|
||||
this.docBase.rightArrowBtn = document.getElementById('rightarrow-btn');
|
||||
this.docBase.leftArrowBtn = document.getElementById('leftarrow-btn');
|
||||
this.docBase.leftArrowWrapper = document.getElementsByClassName('leftarrow-wrapper')[0];
|
||||
this.docBase.rightArrowWrapper = document.getElementsByClassName('rightarrow-wrapper')[0];
|
||||
this.docBase.toolbarWrapper = document.getElementsByClassName('biz-doc-toolbar-wrapper')[0];
|
||||
this.docBase.rightArrowBtn.classList.add('e-icons');
|
||||
this.docBase.rightArrowBtn.classList.add('biz_right_arrow');
|
||||
this.docBase.leftArrowBtn.classList.add('e-icons');
|
||||
this.docBase.leftArrowBtn.classList.add('biz_left_arrow');
|
||||
this.docBase.leftArrowBtn.classList.add('e-disabled');
|
||||
this.docBase.leftArrowWrapper.style.display = 'none';
|
||||
this.docBase.rightArrowWrapper.style.display = 'none';
|
||||
this.setToolbarWidth();
|
||||
this.docBase.rightArrowBtn.addEventListener('click', () => {
|
||||
this.docBase.toolbarWrapper.scrollBy({
|
||||
top: 0,
|
||||
left: 300,
|
||||
behavior: "smooth"
|
||||
});
|
||||
this.docBase.leftArrowBtn.classList.remove('e-disabled');
|
||||
});
|
||||
this.docBase.leftArrowBtn.addEventListener('click', () => {
|
||||
this.docBase.toolbarWrapper.scrollBy({
|
||||
top: 0,
|
||||
left: -300,
|
||||
behavior: "smooth"
|
||||
});
|
||||
this.docBase.rightArrowBtn.classList.remove('e-disabled');
|
||||
});
|
||||
this.docBase.toolbarWrapper.addEventListener('scroll', () => {
|
||||
if (this.docBase.toolbarWrapper.scrollWidth - this.docBase.toolbarWrapper.scrollLeft - this.docBase.toolbarWrapper.clientWidth < 1) {
|
||||
this.docBase.rightArrowBtn.classList.add("e-disabled");
|
||||
}
|
||||
else if (this.docBase.toolbarWrapper.scrollLeft == 0) {
|
||||
this.docBase.leftArrowBtn.classList.add("e-disabled");
|
||||
}
|
||||
});
|
||||
window.addEventListener('resize', () => {
|
||||
this.setToolbarWidth();
|
||||
});
|
||||
}
|
||||
setDisplay(value) {
|
||||
this.docBase.leftArrowWrapper.style.display = value;
|
||||
this.docBase.rightArrowWrapper.style.display = value;
|
||||
}
|
||||
getBtnsWidth() {
|
||||
return document.getElementsByClassName('leftarrow-wrapper')[0].getBoundingClientRect().width + document.getElementsByClassName('rightarrow-wrapper')[0].getBoundingClientRect().width;
|
||||
}
|
||||
setToolbarWidth() {
|
||||
if (window.innerWidth <= this.docBase.toolbarWidth + this.getBtnsWidth()) {
|
||||
this.setDisplay('');
|
||||
this.docBase.toolbarWrapper.style.width = 'calc(100% - 72px)';
|
||||
}
|
||||
else {
|
||||
this.setDisplay('none');
|
||||
this.docBase.toolbarWrapper.style.width = this.docBase.toolbarWidth + 3 + 'px';
|
||||
}
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new Ribbon();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
DocEditor.Ribbon = Ribbon;
|
||||
})(DocEditor = Components.DocEditor || (Components.DocEditor = {}));
|
||||
})(Components = Collaboration.Components || (Collaboration.Components = {}));
|
||||
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
|
||||
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
|
||||
})(Unibase || (Unibase = {}));
|
||||
Исполняемый файл
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
+13
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Ссылка в новой задаче
Block a user