Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add confim() #1371

Closed
thlehmann-ionos opened this issue Jun 25, 2024 · 2 comments
Closed

Add confim() #1371

thlehmann-ionos opened this issue Jun 25, 2024 · 2 comments

Comments

@thlehmann-ionos
Copy link

Background

Request

confirm()

  • to be added in one of the next releases
  • to be declared as type in "typings"

Workaround

Adding this as src/oc.d.ts to a typscript-able app:

/// <reference types="@nextcloud/typings" />

declare namespace Nextcloud28WithPolyfills {
	interface DialogsPolyfill {
		confirm(
	        title: string,
	        message: string,
	        callback: Function,
	        modal: boolean): void;
	}

    interface OC extends Nextcloud.v28.OC {
		dialogs: Nextcloud.Common.Dialogs & DialogsPolyfill;
    }
}

declare var OC: Nextcloud28WithPolyfills;
@susnux
Copy link
Contributor

susnux commented Jul 5, 2024

If you use Vue then I recommend simply directly using NcDialog from @nextcloud/vue.

If not you can use this library, as the replacement for the deprecated function is to use the DialogBuilder from this library, see:
https://nextcloud-libraries.github.io/nextcloud-dialogs/classes/index.DialogBuilder.html

@susnux susnux closed this as not planned Won't fix, can't repro, duplicate, stale Jul 5, 2024
@thlehmann-ionos
Copy link
Author

Thanks for pointing that out.

Note: unfortunately, <NcDialog> leads to repetition and possibly inconsistent UI because every confirm dialog has to be re-implemented (icon, button order). ´. Same for the DialogBuilder, which is a bit better because it includes the facility for that, but still repeated code.

thlehmann-ionos added a commit to IONOS-Productivity/nc-simplesettings that referenced this issue Jul 8, 2024
TODO:

* typing: check whether typing "tokenToBeWiped" is possible without as as
  IToken | null (otherwise it's not nullable). Object as PropType<IToken |
  null> did not work.

* styles: confirm/cancel positioning

From nextcloud-libraries/nextcloud-dialogs#1371 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants