Hello,
How do I insert these functions into input type = "text using asp.net mvc 5 htmlhelper?
As here on the forum we have these options using the shortcut keys or buttons
Hello mgebhard, in my case my @ Html.EditorFor are the default.
I wanted to make it the same as the forum message, example when I press Ctrl + B and type the text it will be in bold and when it is sent to the backend keep these features
follow my @ Html.EditorFor:
@ Html.EditorFor (model => model.comentario,
new {htmlAttributes = new {@class = "form-control", @style = "min-height: 150px", id = "comment", name = "comment"}})
You can use jquery and css to make different styles of text in input. It is not difficult to achieve such a requirement by yourself, but more code needs to be written. As bruce(sqlwork.com) said, TinyMCE is a great tool and many other rich text editors also
can help you, saving time but has more functions.
This is an example that can achieve bold, italic and underline styles.
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Hello asteranup, I managed using this Tiny, but I need to adjust his css, because I'm using this text editor inside a modal, when I press to insert a link, the link dialog is behind the initial modal
Please do not force the community to guess what mistakes you've made. Share enough code that the community can run to reproduce this issue or consider debugging your code. At this point, we have no idea what editor or modal you are using. Also we have
no idea what "inputs don't work" means.
Rather than dumping all your code on the forum, take the time to write sample code that the community can run and accurately reproduce the issue. There is no logical reason to have so much code to test a modal and TinyMCE. It indicates you are not debugging
your code. Anyway, I created a sample and cannot reproduce your results.
Hello mgebhard, as you can see in the video I posted the error is in the dialog of the tinymce plugin, when I insert the z-index to stay on my main modal I can't insert the links, since the rest of inserting rich text is working perfectly and I put the entire
code in because it was a modification of a software in production,
and I started using tinymce due to the indication of bruce and asteranup
Hello mgebhard, as you can see in the video I posted the error is in the dialog of the tinymce plugin, when I insert the z-index to stay on my main modal I can't insert the links, since the rest of inserting rich text is working perfectly and I put the entire
code in because it was a modification of a software in production,
and I started using tinymce due to the indication of bruce and asteranup
The first step in debugging is reproducing the problem. The next step is isolating the problem. If you notice there's no z-index in my example code. I'm not sure why you needed to go in this direction. If you want help from the community then it is
up to you provide a code sample the community can run which reproduces the issue. It is not the community's responsibility to guess how to build the code to reproduce this issue. Sharing a video only shows the unwanted results. Feel free to modify my code
above.
By the way, I added link to my example code and I can see the dialog for inserting a link. Perhaps spend a bit more time troubleshooting your code.
Hi mgebhard, first I apologize if we are having difficulties in our comminution,
as they are not very English, I am Brazilian, but now let's go, as in the video I am using a toolbar, I am not having any difficulties post it back-end because this is working correctly, I had to use the z-
index in the modal of inserting link and media of tinymce itself, because if I don't insert it it is behind my modal "Novo Comentario".
However, I don't know if you noticed when I open the modal of an additional media, which in this case is a tinymce plugin, it doesn't allow me to insert a video link.
By the way, I'm using the standard Asp.Net (I don't know if that's how you name it outside Brazil) and not Core
the controller is the same as you are using, One more piece of information I downloaded his nuget in NuGet's Package Manager and it's in the latest version.
Thanks for the help of bruce and asteranup, because I was lost in this subject and had never heard of TinyMCE, if one of you know examples of the usual TinyMCE or have a link showing how I can customize it would be of great help
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
19 Points
89 Posts
bold, italic and underlined in @Html.EditorFor
Jul 08, 2020 07:59 PM|ecocash|LINK
Hello,
How do I insert these functions into input type = "text using asp.net mvc 5 htmlhelper?
As here on the forum we have these options using the shortcut keys or buttons
All-Star
52971 Points
23574 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 08, 2020 08:45 PM|mgebhard|LINK
Use standard CSS. Keep in mind, the EditorFor helper renders a template and you have not shared the template or even the type.
Or
Member
19 Points
89 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 08, 2020 08:52 PM|ecocash|LINK
Hello mgebhard, in my case my @ Html.EditorFor are the default.
I wanted to make it the same as the forum message, example when I press Ctrl + B and type the text it will be in bold and when it is sent to the backend keep these features
follow my @ Html.EditorFor:
@ Html.EditorFor (model => model.comentario,
new {htmlAttributes = new {@class = "form-control", @style = "min-height: 150px", id = "comment", name = "comment"}})
All-Star
58124 Points
15641 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 08, 2020 09:43 PM|bruce (sqlwork.com)|LINK
form text input does not support the input of any formatting information.
this forum input is a custom javascript component that stores a html string in a textarea. This forum uses TinyMCE
https://www.tiny.cloud
Contributor
2690 Points
771 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 09, 2020 08:45 AM|YihuiSun|LINK
Hi ecocash,
You can use jquery and css to make different styles of text in input. It is not difficult to achieve such a requirement by yourself, but more code needs to be written. As bruce(sqlwork.com) said, TinyMCE is a great tool and many other rich text editors also can help you, saving time but has more functions.
This is an example that can achieve bold, italic and underline styles.
Here is the result.
Best regards,
YihuiSun
All-Star
20953 Points
4984 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 09, 2020 09:03 AM|asteranup|LINK
you can tryhttps://www.tiny.cloud/docs/demo/full-featured/
Anup Das Gupta
Visit My Blog
You can also connect with me in LinkedIn
Member
19 Points
89 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 13, 2020 02:48 PM|ecocash|LINK
Hello asteranup, I managed using this Tiny, but I need to adjust his css, because I'm using this text editor inside a modal, when I press to insert a link, the link dialog is behind the initial modal
All-Star
20953 Points
4984 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 13, 2020 02:56 PM|asteranup|LINK
This happens due to z-index issue. You can check details on how to use z-index-
https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
Anup Das Gupta
Visit My Blog
You can also connect with me in LinkedIn
Member
19 Points
89 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 13, 2020 03:01 PM|ecocash|LINK
Do you use this tool? I couldn't get him to pull my css, I managed to put his dialog in front of my modal, however the inputs don't work
All-Star
52971 Points
23574 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 13, 2020 03:05 PM|mgebhard|LINK
Please do not force the community to guess what mistakes you've made. Share enough code that the community can run to reproduce this issue or consider debugging your code. At this point, we have no idea what editor or modal you are using. Also we have no idea what "inputs don't work" means.
All-Star
20953 Points
4984 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 13, 2020 03:29 PM|asteranup|LINK
Debug z-index of HTML elements in question with developer tool. Or you deploy and share some URL so that community can see.
Anup Das Gupta
Visit My Blog
You can also connect with me in LinkedIn
Member
19 Points
89 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 13, 2020 04:29 PM|ecocash|LINK
Segue meus códigos
Partial_view
script
Member
19 Points
89 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 13, 2020 04:30 PM|ecocash|LINK
I'm using TinyMCE as an editor
Member
19 Points
89 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 13, 2020 04:38 PM|ecocash|LINK
follows the link of the video where the error occurs
https://drive.google.com/file/d/1fsQCCsU9AQM3nU_ucKkFomFTlS3fJCp7/view?usp=sharing
Member
19 Points
89 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 13, 2020 04:39 PM|ecocash|LINK
Hello Bruce, do you have link with examples using this tinycme tool?
All-Star
52971 Points
23574 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 13, 2020 05:36 PM|mgebhard|LINK
Rather than dumping all your code on the forum, take the time to write sample code that the community can run and accurately reproduce the issue. There is no logical reason to have so much code to test a modal and TinyMCE. It indicates you are not debugging your code. Anyway, I created a sample and cannot reproduce your results.
Sample results
Member
19 Points
89 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 13, 2020 05:49 PM|ecocash|LINK
Hello mgebhard, as you can see in the video I posted the error is in the dialog of the tinymce plugin, when I insert the z-index to stay on my main modal I can't insert the links, since the rest of inserting rich text is working perfectly and I put the entire code in because it was a modification of a software in production,
and I started using tinymce due to the indication of bruce and asteranup
All-Star
52971 Points
23574 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 13, 2020 06:14 PM|mgebhard|LINK
The first step in debugging is reproducing the problem. The next step is isolating the problem. If you notice there's no z-index in my example code. I'm not sure why you needed to go in this direction. If you want help from the community then it is up to you provide a code sample the community can run which reproduces the issue. It is not the community's responsibility to guess how to build the code to reproduce this issue. Sharing a video only shows the unwanted results. Feel free to modify my code above.
By the way, I added link to my example code and I can see the dialog for inserting a link. Perhaps spend a bit more time troubleshooting your code.
Member
19 Points
89 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 13, 2020 08:53 PM|ecocash|LINK
Hi mgebhard, first I apologize if we are having difficulties in our comminution,
as they are not very English, I am Brazilian, but now let's go, as in the video I am using a toolbar, I am not having any difficulties post it back-end because this is working correctly, I had to use the z-
index in the modal of inserting link and media of tinymce itself, because if I don't insert it it is behind my modal "Novo Comentario".
However, I don't know if you noticed when I open the modal of an additional media, which in this case is a tinymce plugin, it doesn't allow me to insert a video link.
By the way, I'm using the standard Asp.Net (I don't know if that's how you name it outside Brazil) and not Core
Follow your example using the toolbar
the controller is the same as you are using, One more piece of information I downloaded his nuget in NuGet's Package Manager and it's in the latest version.
Thanks for the help of bruce and asteranup, because I was lost in this subject and had never heard of TinyMCE, if one of you know examples of the usual TinyMCE or have a link showing how I can customize it would be of great help
Contributor
2690 Points
771 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 16, 2020 01:57 AM|YihuiSun|LINK
Hi ecocash,
Are you using Bootstrap Modal? Because using Bootstrap modal will prevent anything else from gaining focus. You need to add a custom code.
$('#myModal').on('shown.bs.modal', function () { $(document).off('focusin.modal'); });
For all your previous needs, please refer to the complete example I gave.
Modal
public class TestSample { public string Title { get; set; } [AllowHtml] public string Content { get; set; } }
Controller
View
customizetinymce.js
Here is the result.
Best Regards,
YihuiSun
Member
19 Points
89 Posts
Re: bold, italic and underlined in @Html.EditorFor
Jul 16, 2020 12:29 PM|ecocash|LINK
Hello YihuiSun, that's exactly what I needed, thanks for the help