Skipping Over Quill Buttons with Tabs

I am a big fan of Quill. You can add it to your website, and in minutes have rich text capability (like adding links to the Quill website to your text).

I am also a big, dare I say HUGE fan of tabbing when I am filling out forms. By default, Quill controls (like bold, italic, link, etc) accept focus when you tab, so if a user is filling out and tabbing through a form, when they get to the rich text editor they have to (aaahh!) grab their mouse and navigate into the rich text box.

The short answer is to use jQuery to add a tabeindex -1 (do not allow tab focus) to every button within the .ql-toolbar class, like this:

$(“.ql-toolbar”).find(“:button”).attr(‘tabindex’, ‘-1’);

For good measure, here is the complete Quill code that I am using. It also handles tabbing out of the editor (so when you hit tab you go to the next field). Let me know if you know how to make this better. Thanks!

Matt

 

Advertisements

Error when you Add New Scaffold Item for ApplicationUser

Here is one that took me a couple of minutes to figure out: if you are using ASP.NET MVC, and you select Add New Scaffold Item on ApplicationUser, you will get the following error:

Severity Code Description Project File Line Column Suppression State
Error CS0453 The type ‘string’ must be a non-nullable value type in order to use it as parameter ‘T’ in the generic type or method ‘Nullable’ INV..NETCoreApp,Version=v1.0

This is caused by the scaffolding assuming that Id fields are integers, that are nullable, when the ApplicationUser Id is a string (which is not nullable). This is a quick 1-minute fix. Just go and remove all of the question marks after the string, For example:

Details(string? id)

Becomes

Details(string id)

Super simple.

Until next time…

Matt

Hey Microsoft People: Anybody Have an All-Up ASP.NET Core Sample Application?

ASP.NET Core is the newest incarnation of ASP.NET. It allows developers to deploy their applications on any server, not just IIS or Azure, but also Linux. This marks a pretty significant shift for Microsoft, and I absolutely love that Microsoft is branching out.

But, I do have a simple question: has anybody provided comprehensive sample application that shows how all of these Core components work together? There are a ton of great samples on the web for building out sample apps in previous versions of ASP.NET, but there is nothing that I have found that demonstrates an end-to-end yet basic ASP.NET Core application that includes ASP.NET Core MVC and ASP.NET Identity Core.

Let’s get specific: I want to see something like a blog application with multiple authors and a blog administrator, where the users can create and edit/delete their own posts, create and edit/delete their own comments on other people’s posts, and an administrator can create, edit, and delete anything. I actually do not care what the application is, but I do want to see some navigation properties (and whether Lazy Loading works or not, and if it does not work, the right way to get related data loaded), something that leverages Identity Core to manage authentication, authorization, and content (e.g., I want to click on an author’s name, and see all of the posts that they have written).

If you want to get fancy: include minimalist testing (e.g., based on your experience, what are some smart tests to include right off the bat), use Visual Studio 2015, add some additional properties to an Application User (from the ASP.NET Identity Core), create roles and associate users with roles (e.g., admin and author), showcase how to use Scaffolding in an agile manner (e.g., as you change the data model, do you just delete the controller and then add using Scaffolding again…or what is the practice).

It feels like so much code is being developed that the communication of how to leverage the code has become highly siloed and it is difficult to stitch together the right way to do things from a comprehensive perspective. BUT, with a simple sample project (and ideally a quick write-up of how it works) would work wonders to bring more people under the MVC Core umbrella.

If this post already exists, please show me the way. If it does not yet exist, but you could create such a thing, please spend an hour writing out the bullet points or creating a screen recording, and I can convert it into a (temporarily) awesome blog post for you.

Thanks in advance.

Matt

Ps-If you do not have this magic blog post that covers ASP.NET Core that includes ASP.NET Core MVC and ASP.NET Identity Core, but you would like to see how all these technologies play together, please drop a comment!

Some useful articles:

Resource-based authorization in ASP.NET MVC: https://docs.microsoft.com/en-us/aspnet/core/security/authorization/resourcebased