Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Service/ImageService.php11
-rw-r--r--src/components/MenuBar.vue7
2 files changed, 11 insertions, 7 deletions
diff --git a/lib/Service/ImageService.php b/lib/Service/ImageService.php
index bba8ca5e6..db691a95f 100644
--- a/lib/Service/ImageService.php
+++ b/lib/Service/ImageService.php
@@ -32,6 +32,7 @@ use OCP\Constants;
use OCP\Files\Folder;
use OCP\Files\File;
use OCP\Files\NotFoundException;
+use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\IPreview;
use OCP\Share\Exceptions\ShareNotFound;
@@ -153,7 +154,7 @@ class ImageService {
public function uploadImage(int $documentId, string $newFileName, string $newFileContent, string $userId): array {
$textFile = $this->getTextFile($documentId, $userId);
if (!$textFile->isUpdateable()) {
- throw new Exception('No write permissions');
+ throw new NotPermittedException('No write permissions');
}
$saveDir = $this->getOrCreateAttachmentDirectoryForFile($textFile);
if ($saveDir !== null) {
@@ -184,7 +185,7 @@ class ImageService {
*/
public function uploadImagePublic(?int $documentId, string $newFileName, string $newFileContent, string $shareToken): array {
if (!$this->hasUpdatePermissions($shareToken)) {
- throw new Exception('No write permissions');
+ throw new NotPermittedException('No write permissions');
}
$textFile = $this->getTextFilePublic($documentId, $shareToken);
$saveDir = $this->getOrCreateAttachmentDirectoryForFile($textFile);
@@ -218,7 +219,7 @@ class ImageService {
public function insertImageFile(int $documentId, string $path, string $userId): array {
$textFile = $this->getTextFile($documentId, $userId);
if (!$textFile->isUpdateable()) {
- throw new Exception('No write permissions');
+ throw new NotPermittedException('No write permissions');
}
$imageFile = $this->getFileFromPath($path, $userId);
$saveDir = $this->getOrCreateAttachmentDirectoryForFile($textFile);
@@ -271,7 +272,7 @@ class ImageService {
public function insertImageLink(int $documentId, string $link, string $userId): array {
$textFile = $this->getTextFile($documentId, $userId);
if (!$textFile->isUpdateable()) {
- throw new Exception('No write permissions');
+ throw new NotPermittedException('No write permissions');
}
$saveDir = $this->getOrCreateAttachmentDirectoryForFile($textFile);
if ($saveDir !== null) {
@@ -294,7 +295,7 @@ class ImageService {
*/
public function insertImageLinkPublic(?int $documentId, string $link, string $shareToken): array {
if (!$this->hasUpdatePermissions($shareToken)) {
- throw new Exception('No write permissions');
+ throw new NotPermittedException('No write permissions');
}
$textFile = $this->getTextFilePublic($documentId, $shareToken);
$saveDir = $this->getOrCreateAttachmentDirectoryForFile($textFile);
diff --git a/src/components/MenuBar.vue b/src/components/MenuBar.vue
index 58ef2d67f..454bcea43 100644
--- a/src/components/MenuBar.vue
+++ b/src/components/MenuBar.vue
@@ -55,22 +55,25 @@
<ActionButton
icon="icon-upload"
:close-after-click="true"
+ :disabled="uploadingImage"
@click="onUploadImage(commands.image)">
{{ t('text', 'Upload from computer') }}
</ActionButton>
<ActionButton v-if="!isPublic"
icon="icon-folder"
:close-after-click="true"
+ :disabled="uploadingImage"
@click="showImagePrompt(commands.image)">
{{ t('text', 'Insert from Files') }}
</ActionButton>
- <ActionButton v-show="!showImageLinkPrompt"
+ <ActionButton v-if="!showImageLinkPrompt"
icon="icon-link"
:close-after-click="false"
+ :disabled="uploadingImage"
@click="showImageLinkPrompt = true">
{{ t('text', 'Insert from link') }}
</ActionButton>
- <ActionInput v-show="showImageLinkPrompt"
+ <ActionInput v-else
icon="icon-link"
:value="imageLink"
@update:value="onImageLinkUpdateValue"