[bug] Remove external request in info dialog

This commit is contained in:
Sergey Konovalov
2025-06-13 18:50:19 +03:00
parent 4de6239c76
commit e4ea617ba8
7 changed files with 769 additions and 17 deletions

View File

@ -20,14 +20,14 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Edit action</title>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js"></script>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins-ui.js"></script>
<script type="text/javascript" src="../js/plugins.js"></script>
<script type="text/javascript" src="../js/plugins-ui.js"></script>
<script type="text/javascript" src="scripts/engine/providers/base.js"></script>
<script type="text/javascript" src="components/Tooltip/script.js"></script>
<script type="text/javascript" src="../js/plugin-stub.js"></script>
<script src="vendor/jquery/jquery-3.7.1.min.js"></script>
<script src="vendor/select2-4.0.6-rc.1/dist/js/select2.js"></script>
<link rel="stylesheet" href="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css">
<link rel="stylesheet" href="../css/plugins.css">
<link rel="stylesheet" href="vendor/select2-4.0.6-rc.1/dist/css/select2.css"/>
<link rel="stylesheet" href="./resources/styles/common.css">
<link rel="stylesheet" href="./resources/styles/aiModelEdit.css">

View File

@ -20,12 +20,12 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>AI Models list</title>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js"></script>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins-ui.js"></script>
<script type="text/javascript" src="../js/plugins.js"></script>
<script type="text/javascript" src="../js/plugins-ui.js"></script>
<script type="text/javascript" src="./components/ListView/script.js"></script>
<script type="text/javascript" src="../js/plugin-stub.js"></script>
<script src="vendor/jquery/jquery-3.7.1.min.js"></script>
<link rel="stylesheet" href="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css">
<link rel="stylesheet" href="../css/plugins.css">
<link rel="stylesheet" href="./resources/styles/common.css">
<link rel="stylesheet" href="./components/ListView/style.css">
<link rel="stylesheet" href="./resources/styles/aiModelsList.css">

View File

@ -20,13 +20,13 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Settings</title>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js"></script>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins-ui.js"></script>
<script type="text/javascript" src="../js/plugins.js"></script>
<script type="text/javascript" src="../js/plugins-ui.js"></script>
<script src="vendor/jquery/jquery-3.7.1.min.js"></script>
<script src="vendor/select2-4.0.6-rc.1/dist/js/select2.js"></script>
<script type="text/javascript" src="../js/plugin-stub.js"></script>
<script type="text/javascript" src="scripts/engine/providers/base.js"></script>
<link rel="stylesheet" href="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css">
<link rel="stylesheet" href="../css/plugins.css">
<link rel="stylesheet" href="vendor/select2-4.0.6-rc.1/dist/css/select2.css"/>
<link rel="stylesheet" href="./resources/styles/common.css">
<link rel="stylesheet" href="./resources/styles/settings.css">

View File

@ -0,0 +1,666 @@
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 11px;
}
/* button */
.btn-text-default {
background: #fff;
border: 1px solid #cfcfcf;
border-radius: 2px;
color: #444444;
font-size: 11px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
height: 22px;
cursor: pointer;
}
.btn-text-default::-moz-focus-inner {
border: 0;
padding: 0;
}
.btn-text-default.submit {
font-weight: bold;
background-color: #d8dadc;
border: 1px solid transparent;
}
.btn-text-default.submit.primary {
color: #fff;
background-color: #7d858c;
}
.btn-text-default:focus {
outline: 0;
outline-offset: 0;
}
.btn-text-default:hover {
background-color: #d8dadc;
}
.btn-text-default.submit:hover {
background-color: #cbced1;
}
.btn-text-default.primary:hover {
background-color: #666d73 !important;
color: #fff;
}
.btn-text-default:active,
.btn-text-default.active {
background-color: #7d858c !important;
color: white;
-webkit-box-shadow: none;
box-shadow: none;
border: 1px solid transparent;
}
.btn-text-default[disabled]:hover,
.btn-text-default.disabled:hover,
.btn-text-default[disabled]:active,
.btn-text-default[disabled].active,
.btn-text-default.disabled:active,
.btn-text-default.disabled.active {
background-color: #fff !important;
color: #444444;
cursor: default;
}
.btn-text-default[disabled],
.btn-text-default.disabled {
opacity: 0.65;
}
.btn-edit {
width: 13px;
height: 13px;
cursor: pointer;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAGZSURBVHgBfZI/y4FRGMavx7+SRQaTTQab74CVlBKL/FukDGQhEgsDNh/Apiw+gcXm70DJoEikKMUk7vec8/Yi75O7Tj2d+/4913Wuc6Tz+UyQqev1itvtBr1e/6+nkgP2+z0qlYr4DgaDsNls36HtdotisYhoNAqLxYJyuSz230HFO7DZbISC0+lEp9OBRqNBLpdDq9XCeDx+DfIz8TWZTIhZodFoRMvlknw+H8XjcdrtdrRarYgpU6/XE7MC4oMc4OB8Pie/30/ZbJba7TYlk0k6HA4CDIVCxNyQYrFYoNFoIJ1OQ5Ik5PN5WK1WpFIprNdr8H61WhVn5X2VisXg8XhoNpvRYDAgt9tNbICOxyOVSiVyuVzU7/epXq9TIBAQtrkzxeVygclkQrfbhd1uRzgcRq1Ww3A4FKparRbspyJRo9H4G4TD4RD06XQS3pkt8nq9NJ1OiSVGsVjsqfC3nvekVCrxeDxgMBgQiUTEa2g2m8hkMi8FuXtSq9VIJBK43+8iHB7GJ8BL4vY+N3U6HQqFAsxmM+TqB5Je/SVNoN18AAAAAElFTkSuQmCC');
}
/* div button */
div.btn-text-default {
height: fit-content !important;
min-height: 20px;
}
/* input, textarea */
.form-control {
border: 1px solid #cfcfcf;
border-radius: 2px;
box-sizing: border-box;
color: #444444;
font-size: 11px;
height: 22px;
padding: 1px 3px;
-webkit-box-shadow: none;
box-shadow: none;
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
.form-control:focus {
border-color: #848484;
outline: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.form-control[readonly] {
background-color: #fff;
cursor: pointer;
}
.form-control[disabled] {
background-color: #fff;
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
opacity: 0.65;
}
textarea.form-control {
resize: none;
}
input[type='checkbox'].form-control {
height: auto;
margin: 0;
}
@supports(-webkit-appearance: none) or (-moz-appearance: none) {
input[type='checkbox'].form-control {
-webkit-appearance: none;
-moz-appearance: none;
width: 14px;
height: 14px;
background: #fff;
border: 1px solid #cfcfcf;
border-radius: 2px;
padding: 0;
position: relative;
margin: 0;
}
input[type='checkbox'].form-control:checked:after {
content: '';
position: absolute;
border: solid #444444;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
width: 3px;
height: 7px;
left: 4px;
}
input[type='checkbox'].form-control:disabled {
opacity: .5;
}
input[type='radio'].form-control {
appearance: none;
-webkit-appearance: none;
border: 2px solid #fff;
border-radius: 100%;
box-shadow: 0 0 0 1px #cfcfcf;
height: 12px;
width: 12px;
accent-color: #444;
margin: 0 0 1px;
background-color: #fff;
}
input[type='radio'].form-control:checked {
background-color: #444;
}
input[type='radio'].form-control:disabled {
opacity: .5;
}
}
/* label */
label.link {
border-bottom: 1px dotted #aaa;
cursor: pointer;
}
label.for-combo {
height: 22px;
padding-top: 4px;
}
label.header {
font-weight: bold;
}
/* comments */
.user-comment-item {
padding: 5px 0;
width: 100%;
}
.user-comment-item .main-actions{
width: 100%;
display: flex;
padding-bottom: 8px;
font-size: 12px;
}
.user-comment-item .form-control.user-check {
margin-right: 5px;
flex-grow: 0;
flex-shrink: 0;
}
.user-comment-item .user-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: bold;
max-width: 40%;
}
.user-comment-item .user-message {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex-grow: 1;
margin-left: 2px;
}
.user-comment-item .btn-edit {
width: 13px;
height: 13px;
margin-left: 5px;
flex-grow: 0;
flex-shrink: 0;
cursor: pointer;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAGZSURBVHgBfZI/y4FRGMavx7+SRQaTTQab74CVlBKL/FukDGQhEgsDNh/Apiw+gcXm70DJoEikKMUk7vec8/Yi75O7Tj2d+/4913Wuc6Tz+UyQqev1itvtBr1e/6+nkgP2+z0qlYr4DgaDsNls36HtdotisYhoNAqLxYJyuSz230HFO7DZbISC0+lEp9OBRqNBLpdDq9XCeDx+DfIz8TWZTIhZodFoRMvlknw+H8XjcdrtdrRarYgpU6/XE7MC4oMc4OB8Pie/30/ZbJba7TYlk0k6HA4CDIVCxNyQYrFYoNFoIJ1OQ5Ik5PN5WK1WpFIprNdr8H61WhVn5X2VisXg8XhoNpvRYDAgt9tNbICOxyOVSiVyuVzU7/epXq9TIBAQtrkzxeVygclkQrfbhd1uRzgcRq1Ww3A4FKparRbspyJRo9H4G4TD4RD06XQS3pkt8nq9NJ1OiSVGsVjsqfC3nvekVCrxeDxgMBgQiUTEa2g2m8hkMi8FuXtSq9VIJBK43+8iHB7GJ8BL4vY+N3U6HQqFAsxmM+TqB5Je/SVNoN18AAAAAElFTkSuQmCC');
}
.user-comment-item .reply-actions,
.user-comment-item .comment-edit {
padding-left: 18px;
padding-bottom: 10px;
}
.user-comment-item .reply-view {
padding-left: 18px;
}
.user-comment-item .reply-view .comment-edit{
padding-left: 0;
}
.user-comment-item .msg-edit {
width: 100%;
height: 45px;
margin-bottom: 3px;
}
.user-comment-item .reply-accept {
margin-bottom: 7px;
}
.user-comment-item .reply-accept label,
.user-comment-item .reply-accept .user-check {
vertical-align: middle;
}
/* common styles */
.hidden {
display: none;
}
.separator.horizontal {
width: 100%;
height: 0;
border-left: none;
border-right: none;
border-top: 1px solid #cbcbcb;
}
.defaultlable {
color: #444444;
cursor: default;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 11px;
font-weight: normal;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.defaultcenterlable {
color: #444444;
cursor: default;
text-align: center;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 11px;
font-style: normal;
font-weight: normal;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
margin: 0px;
padding: 0px;
width: 100%;
}
.aboutlable {
color: #444444;
cursor: default;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 12px;
font-weight: normal;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
a.aboutlink {
color: #444444;
text-decoration: none;
}
a.aboutlink:hover {
text-decoration: underline;
}
a.aboutlink:active {
text-decoration: underline;
}
.noselect{
-khtml-user-select: none;
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
}
.select2-dropdown,
.select2-container--default .select2-selection--single {
border: 1px solid #cfcfcf !important;
}
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus:not(.select2-container--disabled) .select2-selection--single{
border-color: #848484 !important;
}
.select2-container .select2-selection--single .select2-selection__rendered,
.select2-results__options {
font-size: 11px !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 20px !important;
}
.select2-container--default .select2-results__option[aria-selected=true] {
color: #ffffff;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b{
width: 4px !important;
height: 4px !important;
margin: -1px 1px !important;
border: solid 1px #444 !important;
border-bottom: none !important;
border-right: none !important;
background-image: none;
box-sizing: border-box;
transition: transform 0.2s ease;
transform: rotate(-135deg) translate(1px,1px);
}
.select2-container--default .select2-search .select2-selection__arrow b {
width: 4px !important;
height: 4px !important;
margin: -1px 1px !important;
border: solid 1px #404040 !important;
border-bottom: none !important;
border-right: none !important;
background-image: none;
box-sizing: border-box;
transition: transform 0.2s ease;
transform: rotate(-135deg) translate(1px,1px);
left: 50%;
position: absolute;
top: 50%;
}
.select2-search--dropdown {
padding: 0px !important;
}
.select2-container--default.select2-container--open .select2-selection__arrow b{
transform: rotate(45deg);
}
.select2-container--default .select2-search--dropdown .select2-search__field {
outline: none;
border-color: #cfcfcf;
border-radius: 2px;
font-size: 11px;
}
.select2-search.select2-search--dropdown .select2-selection__arrow {
height: 20px;
position: absolute;
top: 1px;
right: 1px;
width: 20px;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: #d8dadc !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected=true] {
background-color: #7d858c !important;
}
.select2-search.select2-search--dropdown .select2-selection__arrow {
cursor: pointer !important
}
.select2-container {
max-height : 20px !important;
}
.select2-container--default.select2-container--disabled{
opacity: 0.65 !important
}
/*
* Container style
*/
.ps {
overflow: hidden !important;
overflow-anchor: none;
-ms-overflow-style: none;
touch-action: auto;
-ms-touch-action: auto;
}
/*
* Scrollbar rail styles
*/
.ps__rail-x {
display: none;
bottom: 2px; /* there must be 'right' for ps-scrollbar-y-rail */
height: 9px;
margin: 0 2px 0 2px;
/* please don't change 'position' */
position: absolute;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
transition: background-color .2s linear, opacity .2s linear;
}
.ps__rail-y {
display: none;
right: 2px; /* there must be 'right' for ps-scrollbar-y-rail */
width: 9px;
margin: 2px 0 2px 0;
/* please don't change 'position' */
position: absolute;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
transition: background-color .2s linear, opacity .2s linear;
}
.ps--active-x > .ps__rail-x,
.ps--active-y > .ps__rail-y {
display: block;
background-color: transparent;
}
.ps .ps__rail-x:hover,
.ps .ps__rail-y:hover,
.ps .ps__rail-x:focus,
.ps .ps__rail-y:focus,
.ps .ps__rail-x.ps--clicking,
.ps .ps__rail-y.ps--clicking {
background-color: #EEEEEE;
}
/*
* Scrollbar thumb styles
*/
.ps__thumb-x {
position: absolute; /* please don't change 'position' */
bottom: 0; /* there must be 'bottom' for ps-scrollbar-x */
height: 9px;
background-color: rgb(241, 241, 241);
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
visibility: visible;
display: block;
box-sizing: border-box;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAOCAYAAAD0f5bSAAAACXBIWXMAAB2HAAAdhwGP5fFlAAAALElEQVQokWNgoBs4f/78f1JpJnIsIkvTsAQfP378TypNxyD/+PEjyRrJsgkAKS81km7nDNQAAAAASUVORK5CYII=);
image-rendering: pixelated;
background-repeat: no-repeat;
background-position: center 0;
border: 1px solid #cfcfcf;
}
.ps__thumb-y {
position: absolute; /* please don't change 'position' */
right: 0; /* there must be 'right' for ps-scrollbar-y */
width: 9px;
background-color: rgb(241, 241, 241);
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
visibility: visible;
display: block;
box-sizing: border-box;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAANCAQAAAAz1Zf0AAAAIUlEQVR42mNgAILz/0GQAQo+/gdBBqLAqE5ydH5k+sgEANHgUH2JtDRHAAAAAElFTkSuQmCC);
image-rendering: pixelated;
background-repeat: no-repeat;
background-position: 0 center;
border: 1px solid #cfcfcf;
}
.ps__rail-x:hover > .ps__thumb-x {
background-color: rgb(207, 207, 207);
}
.ps__thumb-x:hover {
background-position: center -7px;
}
.ps__rail-x:focus > .ps__thumb-x,
.ps__rail-x.ps--clicking .ps__thumb-x {
background-color: #adadad;
border-color: #adadad;
background-position: center -7px;
}
.ps__rail-y:hover > .ps__thumb-y {
background-color: rgb(207, 207, 207);
}
.ps__thumb-y:hover {
background-position: -7px center;
}
.ps__rail-y:focus > .ps__thumb-y,
.ps__rail-y.ps--clicking .ps__thumb-y {
background-color: #adadad;
border-color: #adadad;
background-position: -7px center;
}
/* MS supports */
@supports (-ms-overflow-style: none) {
.ps {
overflow: auto !important;
}
}
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
.ps {
overflow: auto !important;
}
}
/* loader */
@keyframes rotation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.asc-loader-container {
position: relative;
}
.asc-plugin-loader {
position: absolute;
left: 50%;
top: 50%;
margin-top: -10px;
z-index: 10000;
line-height: 20px;
background-image: none;
background-color: transparent;
color: #444444;
transform: translate(-50%, 0);
}
.asc-plugin-loader .asc-loader-image {
height: 20px;
width: 20px;
float: left;
margin-top: -1px;
animation-duration: .8s;
animation-name: rotation;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
.asc-loader-image-light {
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyOCAyOCI+PGNpcmNsZSBjeD0iMTQiIGN5PSIxNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjEuNSIgcj0iMTAuMjUiIHN0cm9rZS1kYXNoYXJyYXk9IjE2MCUsIDQwJSIgLz48L3N2Zz4=);
}
.asc-loader-image-dark {
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAyMCI+PGNpcmNsZSBjeD0iMTAiIGN5PSIxMCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjNDQ0IiBzdHJva2Utd2lkdGg9IjEuNSIgcj0iNy4yNSIgc3Ryb2tlLWRhc2hhcnJheT0iMTYwJSwgNDAlIiAvPjwvc3ZnPg==);
}
.asc-plugin-loader .asc-loader-title {
font-size: 13px;
padding-left: 25px;
min-width: 100px;
}
/* default scroll */
/* * {
scrollbar-width: thin;
} */
*::-webkit-scrollbar {
width: 9px;
height: 9px;
}
*::-webkit-scrollbar-thumb {
border-radius: 2px;
border: 1px solid;
image-rendering: pixelated;
background-repeat: no-repeat;
cursor: default;
}
*::-webkit-scrollbar-track {
cursor: default;
}
*::-webkit-scrollbar-thumb:vertical {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAANCAQAAAAz1Zf0AAAAIUlEQVR42mNgAILz/0GQAQo+/gdBBqLAqE5ydH5k+sgEANHgUH2JtDRHAAAAAElFTkSuQmCC);
background-position: 0px center;
}
*::-webkit-scrollbar-thumb:horizontal {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAOCAYAAAD0f5bSAAAACXBIWXMAAB2HAAAdhwGP5fFlAAAALElEQVQokWNgoBs4f/78f1JpJnIsIkvTsAQfP378TypNxyD/+PEjyRrJsgkAKS81km7nDNQAAAAASUVORK5CYII=);
background-position: center 0px;
}
*::-webkit-scrollbar-thumb:vertical:hover {
background-position: -7px center;
}
*::-webkit-scrollbar-thumb:horizontal:hover {
background-position: center -7px;
}

View File

@ -7,8 +7,6 @@ const AIIntegration = {
// Current state
currentView: 'settings',
isCollapsed: true,
loadedIframes: 0,
totalIframes: 3,
// Callback functions
onSave: null,
@ -46,7 +44,7 @@ const AIIntegration = {
<div class="ai-controls" id="ai-controls">
<button class="ai-btn" id="ai-btn-back" style="display: none;">Back</button>
<button class="ai-btn" id="ai-btn-cancel" style="display: none;">Cancel</button>
<button class="ai-btn" id="ai-btn-reset-all-settings" style="display: none;">Reset All Settings</button>
<button class="ai-btn" id="ai-btn-reset-all-settings" style="display: none;">Restore Defaults</button>
<button class="ai-btn" id="ai-btn-reset-actions" style="display: none;">Reset Tasks</button>
<button class="ai-btn primary" id="ai-btn-save" style="display: none;">Save</button>
<button class="ai-btn primary" id="ai-btn-ok" style="display: none;">OK</button>
@ -230,7 +228,6 @@ const AIIntegration = {
* @param {string} view - The view to navigate to ('settings', 'aiModelEdit', 'aiModelsList')
*/
navigateToView(view) {
const previousView = this.currentView;
this.currentView = view;
this.loadCurrentView();
},
@ -310,8 +307,5 @@ const AIIntegration = {
// Initialize when DOM is ready
document.addEventListener('DOMContentLoaded', () => {
// Wait a bit for the main page to load
setTimeout(() => {
AIIntegration.init();
}, 500);
AIIntegration.init();
});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,38 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
(function(b,t){function v(a){b.Asc.plugin.ie_channel?b.Asc.plugin.ie_channel.postMessage(a):b.parent.postMessage(a,"*")}function q(a,c){if(!a||"object"!=typeof a&&"array"!=typeof a)return a;c=c===t?{}:c;for(var f in a)a.hasOwnProperty(f)&&(c[f]=a[f]&&"object"===typeof a[f]?q(a[f]):a[f]);return c}function m(a){var c=b.location.search,f=a+"=";a=c.indexOf(f);return 0<=a?(a+=f.length,f=c.indexOf("&",a),0>f&&(f=c.length),c.substring(a,f)):t}function l(){var a=m("windowID");a&&(b.Asc.plugin.windowID=a,
b.Asc.plugin.guid||(b.Asc.plugin.guid=decodeURIComponent(m("guid"))));return t!==a?!0:!1}function n(a){if(b.Asc&&b.Asc.plugin)if(b.plugin_onMessage)b.Asc.supportOrigins[a.origin]&&b.plugin_onMessage(a);else if(b.Asc.plugin._initInternal&&"string"==typeof a.data){var c={};try{c=JSON.parse(a.data)}catch(f){c={}}"plugin_init"==c.type&&(b.Asc.supportOrigins[a.origin]=!0,b.Asc.plugin.ie_channel_check(a),eval(c.data))}}b.Asc=b.Asc||{};b.Asc.plugin={};b.Asc.plugin.ie_channel=null;b.Asc.plugin.ie_channel_check=
function(a){var c=navigator.userAgent.toLowerCase();(-1<c.indexOf("msie")||-1<c.indexOf("trident"))&&a.ports&&a.ports[0]&&(this.ie_channel=a.ports[0])};b.Asc.plugin.tr_init=!1;b.Asc.plugin.tr=function(a){return a};b.Asc.scope={};b.Asc.scope.prototype={clear:function(){for(var a in b.Asc.scope)delete b.Asc.scope[a]}};b.onload=function(){if(b.Asc&&b.Asc.plugin){var a=new XMLHttpRequest;a.open("get","./config.json",!0);a.responseType="json";a.onload=function(){if(b.Asc&&b.Asc.plugin){if(404===a.status)return a.onerror();
if(200==a.status||0==a.status&&4==a.readyState){var c=a.response;"string"==typeof c&&(c=JSON.parse(c));q(c,b.Asc.plugin);c={type:"initialize",guid:b.Asc.plugin.guid};l()&&(c.windowID=b.Asc.plugin.windowID);var f=document.body;f&&!0!==b.Asc.plugin.enableDrops&&(f.ondrop=function(h){h&&h.preventDefault&&h.preventDefault();return!1},f.ondragenter=function(h){h&&h.preventDefault&&h.preventDefault();return!1},f.ondragover=function(h){h&&h.preventDefault&&h.preventDefault();h&&h.dataTransfer&&(h.dataTransfer.dropEffect=
"none");return!1});b.Asc.plugin._initInternal=!0;b.parent.postMessage(JSON.stringify(c),"*")}}};a.onerror=function(){if(b.Asc&&b.Asc.plugin&&l()){var c={type:"initialize",guid:b.Asc.plugin.guid};c.windowID=b.Asc.plugin.windowID;b.Asc.plugin._initInternal=!0;b.parent.postMessage(JSON.stringify(c),"*")}};a.send()}};b.Asc.supportOrigins={};b.Asc.supportOrigins[b.origin]=!0;b.addEventListener?b.addEventListener("message",n,!1):b.attachEvent("onmessage",n);b.Asc.plugin._attachCustomMenuClickEvent=function(a,
c,f){this[a]||(this[a]={});this[a][c]=f};b.Asc.plugin._onCustomMenuClick=function(a,c){var f=t,h=c.indexOf("_oo_sep_");-1!==h&&(f=c.substring(h+8),c=c.substring(0,h));this[a]&&this[a][c]&&this[a][c].call(this,f)};b.Asc.plugin.attachContextMenuClickEvent=function(a,c){this._attachCustomMenuClickEvent("contextMenuEvents",a,c)};b.Asc.plugin.event_onContextMenuClick=function(a){this._onCustomMenuClick("contextMenuEvents",a)};b.Asc.plugin.attachToolbarMenuClickEvent=function(a,c){this._attachCustomMenuClickEvent("toolbarMenuEvents",
a,c)};b.Asc.plugin.event_onToolbarMenuClick=function(a){this._onCustomMenuClick("toolbarMenuEvents",a)};b.Asc.plugin.event_onContentControlButtonClick=function(a){let c=a&&a.buttonId?a.buttonId:null;a=a&&a.contentControlId?a.contentControlId:null;c&&a&&this.ContentControlButtonEvents&&this.ContentControlButtonEvents[c]&&this.ContentControlButtonEvents[c].call(this,a)};b.Asc.plugin._attachContentControlButtonClickEvent=function(a,c){this.ContentControlButtonEvents||(this.ContentControlButtonEvents=
{});this.ContentControlButtonEvents[a]=c};b.Asc.plugin.attachEvent=function(a,c){var f=b.Asc.plugin;f._events||(f._events={});f._events[a]=c};b.Asc.plugin.detachEvent=function(a){var c=b.Asc.plugin;c._events&&c._events[a]&&delete c._events[a]};b.Asc.plugin.onEvent=function(a,c){var f=b.Asc.plugin;f._events&&f._events[a]&&f._events[a].call(f,c)};b.Asc.plugin.attachEditorEvent=function(a,c){b.Asc.plugin["event_"+a]=c.bind(b.Asc.plugin);v(JSON.stringify({guid:b.Asc.plugin.guid,type:"attachEvent",name:a}))};
b.Asc.plugin.detachEditorEvent=function(a){b.Asc.plugin["event_"+a]&&delete b.Asc.plugin["event_"+a];v(JSON.stringify({guid:b.Asc.plugin.guid,type:"detachEvent",name:a}))};b.onunload=function(){b.addEventListener?b.removeEventListener("message",n,!1):b.detachEvent("onmessage",n)}})(window,void 0);
(function(b,t){function v(){function d(){return(65536+e[k++]).toString(16).substring(1)}if(!b.crypto||!b.crypto.getRandomValues){function g(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return g()+g()+"-"+g()+"-"+g()+"-"+g()+"-"+g()+g()+g()}var e=new Uint16Array(8);b.crypto.getRandomValues(e);var k=0;return d()+d()+"-"+d()+"-"+d()+"-"+d()+"-"+d()+d()+d()}function q(d){return b.Asc.plugin.tr(d)}function m(d,e){this.itemType=h.None;this.editors=["word","cell","slide"];this.id=
e===t?v():e;this.icons=null;this.text="";this.hint=null;this.data="";this.separator=!1;this.lockInViewMode=!0;this.disabled=this.enableToggle=!1;this.parent=d?d:null;this.childs=null;this.parent&&(this.parent.childs||(this.parent.childs=[]),this.parent.childs.push(this))}function l(d,e){m.call(this,d,e);this.itemType=h.ContextMenu;this.showOnOptionsType=[];c.Buttons.ButtonsContextMenu.push(this)}function n(d,e){m.call(this,d,e);this.itemType=h.Toolbar;this.type=f.BigButton;this.tab="";c.Buttons.ButtonsToolbar.push(this)}
function a(d,e){m.call(this,d,e);this.itemType=h.ContentControl;this.checker=null;0===c.Buttons.ButtonsContentControl.length&&c.Buttons.registerContentControl();c.Buttons.ButtonsContentControl.push(this)}b.Asc=b.Asc||{};var c=b.Asc;c.Buttons={};c.Buttons.ButtonsContextMenu=[];c.Buttons.ButtonsToolbar=[];c.Buttons.ButtonsContentControl=[];c.Buttons.registerContextMenu=function(){b.Asc.plugin.attachEvent("onContextMenuShow",function(d){if(d){var e={guid:b.Asc.plugin.guid};for(let k=0,g=c.Buttons.ButtonsContextMenu.length;k<
g;k++){let p=c.Buttons.ButtonsContextMenu[k];if(null===p.parent)p.onContextMenuShow(d,e)}e.items&&b.Asc.plugin.executeMethod("AddContextMenuItem",[e])}})};c.Buttons.registerToolbarMenu=function(){let d={guid:b.Asc.plugin.guid,tabs:[]};for(let e=0,k=c.Buttons.ButtonsToolbar.length;e<k;e++){let g=c.Buttons.ButtonsToolbar[e];null===g.parent&&g.toToolbar(d);if(g.menu)for(item of g.menu)item.onclick&&b.Asc.plugin.attachToolbarMenuClickEvent(item.id,item.onclick)}0<d.tabs.length&&b.Asc.plugin.executeMethod("AddToolbarMenuItem",
[d])};c.Buttons.registerContentControl=function(){b.Asc.plugin.attachEvent("onShowContentControlTrack",function(d){let e={guid:b.Asc.plugin.guid,items:{}},k=[];for(let g=0,p=c.Buttons.ButtonsContentControl.length;g<p;++g)k.push(c.Buttons.ButtonsContentControl[g].onShowTrack(d,e.items));Promise.all(k).then(function(){for(let g in e.items){b.Asc.plugin.executeMethod("AddContentControlButtons",[e]);break}})})};var f={Button:"button",BigButton:"big-button"},h={None:0,ContextMenu:1,Toolbar:2,ContentControl:3};
m.prototype.toItem=function(){let d={id:this.id,text:q(this.text)};null!==this.hint&&(d.hint=q(""===this.hint?this.hint:this.text));this.separator&&(d.separator=!0);this.data&&(d.data=this.data);this.lockInViewMode&&(d.lockInViewMode=!0);this.enableToggle&&(d.enableToggle=!0);this.disabled&&(d.disabled=!0);this.icons&&(d.icons=this.icons);this.itemType===h.Toolbar&&(d.type=this.type);this.menu&&(d.items=this.menu.map(function(e){e.text=q(e.text);return e}));this.split&&(d.split=!0);return d};m.prototype.attachOnClick=
function(d){};m.prototype.onClick=function(){console.log("BUTTON: "+this.text)};l.prototype=Object.create(m.prototype);l.prototype.constructor=l;l.prototype.copy=function(){let d=new l(this.parent,this.id);d.editors=this.editors;d.separator=this.separator;d.lockInViewMode=this.lockInViewMode;d.enableToggle=this.enableToggle;d.disabled=this.disabled;d.showOnOptionsType=this.showOnOptionsType.slice();return d};l.prototype.addCheckers=function(){let d=arguments.length;this.showOnOptionsType=Array(d);
for(let e=0;e<d;e++)this.showOnOptionsType[e]=arguments[e]};l.prototype.attachOnClick=function(d){b.Asc.plugin.attachContextMenuClickEvent(this.id,d)};l.prototype.onContextMenuShowAnalyze=function(d,e){return!1};l.prototype.onContextMenuShowExtendItem=function(d,e){};l.prototype.onContextMenuShow=function(d,e){if(!this.onContextMenuShowAnalyze(d,e)){var k=!1;for(let g=0,p=this.editors.length;g<p;g++)if(c.plugin.info.editorType===this.editors[g]){k=!0;break}if(k)for(let g=0,p=this.showOnOptionsType.length;g<
p;g++)if(d.type===this.showOnOptionsType[g]||"All"===this.showOnOptionsType[g]){e.items||(e.items=[]);k=this.toItem();this.onContextMenuShowExtendItem(d,k);if(this.childs)for(let r=0,x=this.childs.length;r<x;r++)this.childs[r].onContextMenuShow(d,k);e.items.push(k);break}}};n.prototype=Object.create(m.prototype);n.prototype.constructor=n;n.prototype.attachOnClick=function(d){b.Asc.plugin.attachToolbarMenuClickEvent(this.id,d)};n.prototype.toItem=function(d){d=m.prototype.toItem.call(this);d.type=
this.type;return d};n.prototype.toToolbar=function(d){if(null===this.parent){var e={id:this.id,text:q(this.text),items:[]};null!==this.hint&&(e.hint=q(""===this.hint?this.hint:this.text));d.tabs.push(e)}else e=this.toItem(),d.items||(d.items=[]),d.items.push(e);if(this.childs)for(let k=0,g=this.childs.length;k<g;k++)this.childs[k].toToolbar(e)};a.prototype=Object.create(m.prototype);a.prototype.constructor=a;a.prototype.attachOnClick=function(d){b.Asc.plugin._attachContentControlButtonClickEvent(this.id,
d)};a.prototype.addChecker=function(d){d&&"function"===typeof d&&(this.checker=d)};a.prototype.onShowTrack=function(d,e){let k=this.checker,g=[],p=this.toItem();for(let r=0,x=d.length;r<x;++r){let w=d[r];g.push((new Promise(function(u){if(k){let y=k(w);y instanceof Promise?y.then(function(z){u(z)}):u(!!y)}else u(!0)})).then(function(u){u&&(e[w]||(e[w]=[]),e[w].push(p))}))}return Promise.all(g)};c.ToolbarButtonType=f;c.ButtonContextMenu=l;c.ButtonToolbar=n;c.ButtonContentControl=a})(window);