Browse Source

disable line breaks for title

Artal Druk 8 years ago
parent
commit
1cbe66cf53
2 changed files with 12 additions and 1 deletions
  1. 11
    0
      src/ZSSRichTextEditor/ZSSRichTextEditor.js
  2. 1
    1
      src/editor.html

+ 11
- 0
src/ZSSRichTextEditor/ZSSRichTextEditor.js View File

63
     });
63
     });
64
 }
64
 }
65
 
65
 
66
+function disableLineBreakIfNecessary(editorId) {
67
+    var editor = $(`#${editorId}`);
68
+    var disableLineBreaks = editor.attr("disableLineBreaks");
69
+    if (disableLineBreaks) {
70
+        editor.keypress(function(e){ return e.which != 13; });
71
+    }
72
+}
73
+
66
 zss_editor.init = function() {
74
 zss_editor.init = function() {
67
 
75
 
76
+    disableLineBreakIfNecessary('zss_editor_title');
77
+    disableLineBreakIfNecessary('zss_editor_content');
78
+
68
     setupTouchEndEnableEditing('zss_editor_title');
79
     setupTouchEndEnableEditing('zss_editor_title');
69
     setupTouchEndEnableEditing('zss_editor_content');
80
     setupTouchEndEnableEditing('zss_editor_content');
70
 
81
 

+ 1
- 1
src/editor.html View File

15
 
15
 
16
 	<body onLoad="zss_editor.init();">
16
 	<body onLoad="zss_editor.init();">
17
 		<!-- ZSSRichTextEditor Editable Content -->
17
 		<!-- ZSSRichTextEditor Editable Content -->
18
-		<div id="zss_editor_title" class="zs_editor_content" contenteditable="true" placeholder=""></div>
18
+		<div id="zss_editor_title" class="zs_editor_content" contenteditable="true" placeholder="" disableLineBreaks="true"></div>
19
 		<div><hr></div>
19
 		<div><hr></div>
20
 		<div id="zss_editor_content" class="zs_editor_content" contenteditable="true" placeholder=""></div>
20
 		<div id="zss_editor_content" class="zs_editor_content" contenteditable="true" placeholder=""></div>
21
 	</body>
21
 	</body>