I am not able to move scrollbar to see the left side content.
Here I have attached my word document where I copied the content.
I want to format the text immediately after paste the content .
Is there any solution to format the content.And also I have tried your side I got same issue.
This is my code:
@{ Html.Telerik().EditorFor(model => model.Description)
.Name(
"Description")
.HtmlAttributes(
new { style = "width: 680px; height:400px;" })
.Tools(tools =>
tools.Clear().Bold().Italic().Underline().Strikethrough().Separator()
.FontName().FontSize().FontColor().BackColor().Separator()
.JustifyLeft().JustifyCenter().JustifyRight().JustifyFull().Separator()
.InsertOrderedList().InsertUnorderedList().Separator()
.Indent().Outdent().Separator()
.FormatBlock().Separator()
)
.Encode(
true)
.Value(@<text></text>)
.Render();
}
9 Answers, 1 is accepted
Can you please send a Word document, which triggers the described problem?
Kind regards,
Dimo
the Telerik team
The problem is caused by bad document formatting - please note that the main page margins are narrow and they are overridden by custom tabs. This leads to negative margins being applied in the MVC Editor component and part of the content is hidden to the sides. This can be fixed by toggling the Indent tool as well.
On a side note, please always make sure that uploaded attachments are suitable for public review. We may not be able to react quickly and delete attachments in other occasions.
Regards,
Dimo
the Telerik team
We too are facing the same issue and not sure how to resolve this issue. Is there a way for the editor to remove the negative margins and clean up the content before it gets rendered?
We are even trying out htmlagility pack, but it isn't helping us out.
Since ours is a customer facing application, we aren't able to ask them to remove the bad formatting too.
Thank you,
Sujith
Please reply the following thread..
We too are facing the same issue and not sure how to resolve this issue. Is there a way for the editor to remove the negative margins and clean up the content before it gets rendered?
We are even trying out htmlagility pack, but it isn't helping us out.
Since ours is a customer facing application, we aren't able to ask them to remove the bad formatting too.
Thanks,
Thiruppathi.
If removing the offending formatting in the Word document in advance is not an option, then you can use the Editor's paste event to iterate through the editable content's DOM elements and remove all negative margins manually. You will need to use setTimeout, as the paste event is fired before the new content is actually inserted inside the Editor.
The Editor content area's <body> tag can be referenced inside the paste event handler with
$(
this
).data(
"tEditor"
).body
All the best,
Dimo
the Telerik team
Hi,
I have removed pre tag from my word document by using the below code.after removing i want to bind the resulting text without pre tag on the "tEditor" control.Is this correct way to bind the word document
"$(this).data('tEditor').content =str" kindly reply in this.
function Editor_onPaste(e)
{
var str = e.html;
str = str.replace("<PRE.*?", "<p>")
str.replace("</PRE>", "</p>")
$(this).data('tEditor').content =str ;
}
@{ Html.Telerik().EditorFor(model => model.Description )
.Name("Description")
.HtmlAttributes(new { style = "width: 680px; height:400px;" })
.Tools(tools =>
tools.Clear().Bold().Italic().Underline().Strikethrough().Separator()
.FontName().FontSize().FontColor().BackColor().Separator()
.JustifyLeft().JustifyCenter().JustifyRight().JustifyFull().Separator()
.InsertOrderedList().InsertUnorderedList().Separator()
.Indent().Outdent().Separator()
.FormatBlock().Separator()
)
.ClientEvents(events => events.OnPaste("Editor_onPaste"))
.Encode(true)
.Value(@<text></text>)
.Render();
}
Thanks,
Thiruppathi.
Can you reply my previous issue
Thanks,
Thiruppathi.
The Editor value is set with the value() method. There is no property "content".
In addition, as mentioned earlier, you have to use setTimeout to change the Editor's value in the paste handler, because the event is fired before the content is actually changed.
Greetings,
Dimo
the Telerik team