зеркало из
https://github.com/nextcloud/server.git
synced 2024-08-18 02:10:32 +02:00
feat: Add iconSvgInline to TemplateFileCreator
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Этот коммит содержится в:
родитель
c451829579
Коммит
66e77d41c8
@ -44,6 +44,7 @@ namespace OCA\Files;
|
||||
* label: string,
|
||||
* extension: string,
|
||||
* iconClass: ?string,
|
||||
* iconSvgInline: ?string,
|
||||
* mimetypes: string[],
|
||||
* ratio: ?float,
|
||||
* actionLabel: string,
|
||||
|
@ -64,8 +64,8 @@ export function registerTemplateEntries() {
|
||||
addNewFileMenuEntry({
|
||||
id: `template-new-${provider.app}-${index}`,
|
||||
displayName: provider.label,
|
||||
// TODO: migrate to inline svg
|
||||
iconClass: provider.iconClass || 'icon-file',
|
||||
iconSvgInline: provider.iconSvgInline,
|
||||
enabled(context: Folder): boolean {
|
||||
return (context.permissions & Permission.CREATE) !== 0
|
||||
},
|
||||
|
@ -117,6 +117,7 @@ export interface TemplateFile {
|
||||
label: string
|
||||
extension: string
|
||||
iconClass?: string
|
||||
iconSvgInline?: string
|
||||
mimetypes: string[]
|
||||
ratio?: number
|
||||
templates?: Record<string, unknown>[]
|
||||
|
@ -37,6 +37,8 @@ final class TemplateFileCreator implements \JsonSerializable {
|
||||
protected $fileExtension;
|
||||
/** @var ?string $iconClass */
|
||||
protected $iconClass;
|
||||
/** @var ?string $iconSvgInline */
|
||||
protected $iconSvgInline;
|
||||
/** @var ?float $ratio */
|
||||
protected $ratio = null;
|
||||
protected $order = 100;
|
||||
@ -66,12 +68,21 @@ final class TemplateFileCreator implements \JsonSerializable {
|
||||
|
||||
/**
|
||||
* @since 21.0.0
|
||||
* @deprecated 29.0.0
|
||||
*/
|
||||
public function setIconClass(string $iconClass): TemplateFileCreator {
|
||||
$this->iconClass = $iconClass;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 29.0.0
|
||||
*/
|
||||
public function setIconSvgInline(string $iconSvgInline): TemplateFileCreator {
|
||||
$this->iconSvgInline = $iconSvgInline;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 21.0.0
|
||||
*/
|
||||
@ -128,7 +139,7 @@ final class TemplateFileCreator implements \JsonSerializable {
|
||||
|
||||
/**
|
||||
* @since 21.0.0
|
||||
* @return array{app: string, label: string, extension: string, iconClass: ?string, mimetypes: string[], ratio: ?float, actionLabel: string}
|
||||
* @return array{app: string, label: string, extension: string, iconClass: ?string, iconSvgInline: ?string, mimetypes: string[], ratio: ?float, actionLabel: string}
|
||||
*/
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
@ -136,6 +147,7 @@ final class TemplateFileCreator implements \JsonSerializable {
|
||||
'label' => $this->actionName,
|
||||
'extension' => $this->fileExtension,
|
||||
'iconClass' => $this->iconClass,
|
||||
'iconSvgInline' => $this->iconSvgInline,
|
||||
'mimetypes' => $this->mimetypes,
|
||||
'ratio' => $this->ratio,
|
||||
'actionLabel' => $this->actionLabel,
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user