This is a migrated thread and some comments may be shown as answers.

Editing source

17 Answers 447 Views
Editor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jesse
Top achievements
Rank 2
Jesse asked on 27 Jun 2012, 03:10 PM
I'm wanting to changed the default behavior of when you hit enter and it double space to be single spacing when you hit Shift + Enter, but I cannot find out where Shift + Enter is being performed in the source. Also under JavaScript Dependencies there is no list of the required JavaScript files for the editor. Thanks

17 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 02 Jul 2012, 08:06 AM
Hi Jesse,

I have already replied to your support ticket on the same subject. For convenience I am pasting my reply here too, so the other users who experience the same issue can read it: 

In order to achieve the desired behavior you could use the following code snippet:  

var editorNS = kendo.ui.editor,
registerTool = editorNS.EditorUtils.registerTool,
Tool = editorNS.Tool;
registerTool("insertLineBreak", new Tool({ key: 13, command: editorNS.NewLineCommand }));
registerTool("insertParagraph", new Tool({ key: 13, shift: true, command: editorNS.ParagraphCommand }));

Regarding the JavaScript files for the editor in the JavaScript Dependencies section from the documentation - indeed this is an overlook from our side. We have updated this topic from the documentation and the change is already available. As a sign of gratitude I updated your points. 
 

Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
adam
Top achievements
Rank 1
answered on 20 Jul 2012, 02:28 PM
Iliana,
Thank you for your example. This seems to globally affect all editors on the page. Do you have an example where we can make this change isolated to a specific editor?

I found a related post, but it is for the MVC Extensions (http://www.telerik.com/community/code-library/aspnet-mvc/editor/how-to-insert-a-new-line-on-enter-instead-of-a-new-paragraph.aspx). I haven't been able to get it to work.
0
Iliana Dyankova
Telerik team
answered on 24 Jul 2012, 12:03 PM
Hi Adam,

I prepared a small example which illustrates how to make this change only to a specific editor - please find it attached.
 
Greetings,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Christopher Chenoweth
Top achievements
Rank 1
answered on 09 Oct 2012, 08:39 PM
$("#TextArea1").kendoEditor({
    tools: [
  { name: "insertLineBreak", shift: false },
    { name: "insertParagraph", shift: true }
    ],
      
});

The above example is far easier to me and works like a charm.  
0
Don
Top achievements
Rank 1
answered on 11 Feb 2013, 08:14 PM
Is there a way to do this without loosing all the other tools?  If I do the code as shown in previous post (adding a tools node when setting up the editor), the tools string ONLY has these two options.  All other tools are removed.  I dont want to have to add each tool I need to the list, but instead modify the setting for only two of its values.


I was able to fix this by doing the followiing:

$( this ).data( 'kendoEditor' ).tools.insertLineBreak.options.shift = false;
$( this ).data( 'kendoEditor' ).tools.insertParagraph.options.shift = true;

Is there a "cleaner" way to do this?
0
Peter
Top achievements
Rank 1
answered on 14 Mar 2013, 11:00 PM
Hello,
I face the same problem. I want to add <br \> when hitting enter.
How can I change the default behavior in he MVC configuration?

Thank you
0
Iliana Dyankova
Telerik team
answered on 19 Mar 2013, 04:15 PM
Hello Peter,

I have already answered to your support ticket with the same questions, however I am pasting my reply here too: 

In order to achieve this in Kendo UI Editor for ASP.NET MVC you can use the same approach as in Kendo UI Web Editor. 

Also, I am attaching a sample project which demonstrates the desired functionality in action.

Regards,

Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Simon
Top achievements
Rank 1
answered on 19 Mar 2013, 09:00 PM
Hello Iliana,
I have the same problem. Thank you for providing the source code here. However, when I run the test code I receive following JavaScript exception in Visual Studio:

Unhandled exception at line 18, column 11929 in http://localhost:30060/Scripts/kendo/2012.3.1114/kendo.all.min.js

0x800a138f - JavaScript runtime error: Unable to get property 'ownerDocument' of undefined or null reference

I am using IE 9.

Have you any idea how to fix this?
0
Iliana Dyankova
Telerik team
answered on 25 Mar 2013, 03:42 PM
Hi Simon,

I am not quite sure what causes the problem on your side - I tested the example in IE 9 and everything works correctly. Could you please check this short screencast capture and let me know if I missed something? Thank you in advance for your cooperation. 

Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Simon
Top achievements
Rank 1
answered on 02 Apr 2013, 10:46 AM
Hi Iliana,

sorry for my late reply. This is really strange. I am using IE 10 and Visual Studio 2012 and the exception (as shown in my previous picture) is thrown. Maybe this has something to do with Visual Studio 2012?
However, the code/ function works.

Best regards
0
Iliana Dyankova
Telerik team
answered on 05 Apr 2013, 10:06 AM
Hello Simon,

I discussed the case with my colleagues and it appears there was an issue in the editor, however the developers addressed it and the fix will be included in our next internal build. Please excuse us for the inconvenience caused.

Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Dean Wise
Top achievements
Rank 1
answered on 26 Apr 2013, 05:29 PM
Iliana, 
    I'm having the same issue as Simon in IE 9. Is this fix available yet? If so, how can I acqure it?

Thanks,
Dean Wise
0
Iliana Dyankova
Telerik team
answered on 01 May 2013, 11:05 AM
Hello Dean,

I am glad to inform you the fix is already available and it is included in our latest internal build, which you can download from your account (you have to be logged in). Please test your application using the aforementioned build and let me know if you still observe any problems. 

Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ben
Top achievements
Rank 1
answered on 02 May 2013, 12:43 AM
This works great on desktops but not on iPads. It's almost as if the editor isn't detecting the shift event. Regardless of whether you press shift or not, a line break is inserted.
0
Alex Gyoshev
Telerik team
answered on 02 May 2013, 09:05 AM
Hello Ben,

Sadly, we cannot address this problem. The shift key is not reported by iOS. See this SO thread for more details.

Regards,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Craig
Top achievements
Rank 1
answered on 02 Jul 2013, 05:34 PM
i would also like to know more information on this topic.
I am initializing my editor with knockout-kendo bindings, so I need to pass my options in the data-bind statement.
When I try to use these options all the tool bars disappear.  I realize that knockout-kendo isn't a product of Telerik but the binding statements are just independent proxy objects of the underlying Kendo library.

Eeek!

<div data-bind="kendoEditor: { value: PrimaryIAMLReconciliation, tools: [ { name: 'insertLineBreak', shift: false }, { name: 'insertParagraph', shift: true } ] }"></div>
is basically the equivalent of:

$("#TextArea1").kendoEditor({
     tools: [
          { name: "insertLineBreak", shift: false },
          { name: "insertParagraph", shift: true }
     ]
});
0
Alex Gyoshev
Telerik team
answered on 08 Jul 2013, 05:55 AM
Hello Craig,

To achieve this, use the documented approach through the defaultTools array.

Regards,
Alex Gyoshev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Editor
Asked by
Jesse
Top achievements
Rank 2
Answers by
Iliana Dyankova
Telerik team
adam
Top achievements
Rank 1
Christopher Chenoweth
Top achievements
Rank 1
Don
Top achievements
Rank 1
Peter
Top achievements
Rank 1
Simon
Top achievements
Rank 1
Dean Wise
Top achievements
Rank 1
Ben
Top achievements
Rank 1
Alex Gyoshev
Telerik team
Craig
Top achievements
Rank 1
Share this question
or