From 46e78d1b8bfc59d767a3c92c924b3cbb112d14ab Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 9 Apr 2024 19:33:06 +0200 Subject: [PATCH] feat: Deprecate `OC.dialogs.prompt` an replace with Vue implementation Signed-off-by: Ferdinand Thiessen --- core/src/OC/dialogs.js | 79 ++++----------- core/src/components/LegacyDialogPrompt.vue | 107 +++++++++++++++++++++ 2 files changed, 125 insertions(+), 61 deletions(-) create mode 100644 core/src/components/LegacyDialogPrompt.vue diff --git a/core/src/OC/dialogs.js b/core/src/OC/dialogs.js index 77a6657955c..c00a570c963 100644 --- a/core/src/OC/dialogs.js +++ b/core/src/OC/dialogs.js @@ -51,8 +51,9 @@ import IconMove from '@mdi/svg/svg/folder-move.svg?raw' import IconCopy from '@mdi/svg/svg/folder-multiple.svg?raw' import OC from './index.js' -import { FilePickerType, getFilePickerBuilder } from '@nextcloud/dialogs' +import { FilePickerType, getFilePickerBuilder, spawnDialog } from '@nextcloud/dialogs' import { basename } from 'path' +import { defineAsyncComponent } from 'vue' /** * this class to ease the usage of jquery dialogs @@ -169,69 +170,25 @@ const Dialogs = { * @param {string} name name of the input field * @param {boolean} password whether the input should be a password input * @returns {Promise} + * + * @deprecated Use NcDialog from `@nextcloud/vue` instead */ prompt: function(text, title, callback, modal, name, password) { - return $.when(this._getMessageTemplate()).then(function($tmpl) { - var dialogName = 'oc-dialog-' + Dialogs.dialogsCounter + '-content' - var dialogId = '#' + dialogName - var $dlg = $tmpl.octemplate({ - dialog_name: dialogName, - title: title, - message: text, - type: 'notice' - }) - var input = $('') - input.attr('type', password ? 'password' : 'text').attr('id', dialogName + '-input').attr('placeholder', name) - var label = $('