Merge pull request #298 from AlexeyMatveev686/feature/readme

Feature/readme
This commit is contained in:
Oleg Korshul
2023-12-12 17:26:40 +03:00
committed by GitHub
3 changed files with 41 additions and 13 deletions

View File

@ -26,4 +26,11 @@
* Fix problem with cloud version.
* Remove plugin Zoom from plugin manager.
* Fix problem in Windows XP.
* Change content justify for plugins card from center to left side.
* Change content justify for plugins card from center to left side.
## 1.0.5
* Fix problem with arrows without screenshots into a plugin window.
* Fix problem with github link into desktop for installed plugins.
* Fix problem with empty space into a plugin window when we don't have information about version and languages.
* Change "Help Center" link to "README" plugin link.

View File

@ -149,10 +149,10 @@
<span id="span_langs"></span>
</div>
</div>
<div class="div_selected_info">
<div id="div_readme_link" class="div_selected_info">
<span id="span_lern" class="font_bold">Learn how to use </span>
<span id="span_lern_plugin">the plugin in </span>
<a class="aboutlink link_info" target="blank" href="https://api.onlyoffice.com/plugin/basic">Help Center.</a>
<a id="link_readme" class="aboutlink link_info" target="blank" href="">README.</a>
</div>
<div id="div_github_link" class="div_selected_info">
<span id="span_contribute" class="font_bold">Contribute </span>

View File

@ -16,7 +16,7 @@
*
*/
const version = '1.0.4'; // version of store (will change it when update something in store)
const version = '1.0.5'; // version of store (will change it when update something in store)
let start = Date.now();
const isLocal = ( (window.AscDesktopEditor !== undefined) && (window.location.protocol.indexOf('file') !== -1) ); // desktop detecting
let isPluginLoading = false; // flag plugins loading
@ -517,6 +517,8 @@ function initElemnts() {
elements.divVotes = document.getElementById('div_votes');
elements.arrowPrev = document.getElementById('prev_arrow');
elements.arrowNext = document.getElementById('next_arrow');
elements.divReadme = document.getElementById('div_readme_link');
elements.linkReadme = document.getElementById('link_readme');
};
function toogleLoader(show, text) {
@ -978,7 +980,7 @@ function onClickUpdateAll() {
function onClickItem() {
// There we will make preview for selected plugin
let offered = "Ascensio System SIA";
let hiddenCounter = 0;
let guid = this.getAttribute('data-guid');
let pluginDiv = document.getElementById(guid);
let divPreview = document.createElement('div');
@ -1003,14 +1005,15 @@ function onClickItem() {
elements.divRatingLink.setAttribute('title', getTranslated('No disscussion page for this plugin.'));
}
if ( !plugin || ( isLocal && installed ) ) {
if ( !plugin || ( isLocal && installed && plugin.baseUrl.includes('file:') ) ) {
elements.divGitLink.classList.add('hidden');
plugin = installed.obj;
} else {
elements.divGitLink.classList.remove('hidden');
}
let bCorrectUrl = isLocal || ( !plugin.baseUrl.includes('http://') && !plugin.baseUrl.includes('file:') && !plugin.baseUrl.includes('../'));
let bWebUrl = !plugin.baseUrl.includes('http://') && !plugin.baseUrl.includes('file:') && !plugin.baseUrl.includes('../');
let bCorrectUrl = isLocal || bWebUrl;
if (bCorrectUrl && plugin.variations[0].store && plugin.variations[0].store.screenshots && plugin.variations[0].store.screenshots.length) {
let arrScreens = plugin.variations[0].store.screenshots;
@ -1039,8 +1042,8 @@ function onClickItem() {
slideIndex = 1;
showSlides(1);
} else {
elements.arrowPrev.classList.remove('hidden');
elements.arrowNext.classList.remove('hidden');
elements.arrowPrev.classList.add('hidden');
elements.arrowNext.classList.add('hidden');
}
let bHasUpdate = (pluginDiv.lastChild.firstChild.lastChild.tagName === 'SPAN' && !pluginDiv.lastChild.firstChild.lastChild.classList.contains('hidden'));
@ -1051,6 +1054,7 @@ function onClickItem() {
} else {
elements.spanVersion.innerText = '';
elements.divVersion.classList.add('hidden');
hiddenCounter++;
}
if ( (installed && installed.obj.minVersion) || plugin.minVersion ) {
@ -1059,7 +1063,8 @@ function onClickItem() {
} else {
elements.spanMinVersion.innerText = '';
elements.divMinVersion.classList.add('hidden');
}
hiddenCounter++;
}
if (plugin.languages) {
elements.spanLanguages.innerText = plugin.languages.join(', ') + '.';
@ -1067,6 +1072,7 @@ function onClickItem() {
} else {
elements.spanLanguages.innerText = '';
elements.divLanguages.classList.add('hidden');
hiddenCounter++;
}
if (plugin.changelog) {
@ -1088,7 +1094,16 @@ function onClickItem() {
elements.spanName.innerHTML = this.children[1].children[0].innerText;
elements.spanOffered.innerHTML = plugin.offered || offered;
elements.spanSelectedDescr.innerHTML = this.children[1].children[1].innerText;
elements.linkPlugin.setAttribute('href', pluginUrl);
if (bWebUrl) {
elements.linkPlugin.setAttribute('href', pluginUrl);
elements.linkReadme.setAttribute('href', pluginUrl + 'README.md');
elements.divReadme.classList.remove('hidden');
} else {
elements.linkPlugin.setAttribute('href', '');
elements.linkReadme.setAttribute('href', '');
elements.divReadme.classList.add('hidden');
}
if (discussionUrl)
elements.discussionLink.setAttribute('href', discussionUrl);
else
@ -1115,12 +1130,18 @@ function onClickItem() {
if (pluginDiv.lastChild.lastChild.hasAttribute('disabled')) {// || pluginDiv.lastChild.lastChild.hasAttribute('dataDisabled')) {
elements.btnInstall.setAttribute('disabled','');
elements.btnInstall.setAttribute('title', getTranslated(messages.versionWarning));
}
else {
} else {
elements.btnInstall.removeAttribute('disabled');
elements.btnInstall.removeAttribute('title');
}
if (hiddenCounter == 3) {
// if versions and languages fields are hidden, we should hide this div
document.getElementById('div_plugin_info').classList.add('hidden');
} else {
document.getElementById('div_plugin_info').classList.remove('hidden');
}
elements.divSelected.classList.remove('hidden');
elements.divSelectedMain.classList.remove('hidden');
elements.divBody.classList.add('hidden');