Merge lp:~openerp-dev/openerp-web/7.0-opw-587404-msh into lp:openerp-web/7.0

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/7.0-opw-587404-msh
Merge into: lp:openerp-web/7.0
Diff against target: 26 lines (+5/-0)
2 files modified
addons/web/static/lib/cleditor/jquery.cleditor.js (+2/-0)
addons/web/static/src/js/view_form.js (+3/-0)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-opw-587404-msh
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) Pending
Xavier (Open ERP) Pending
OpenERP Core Team Pending
Review via email: mp+159790@code.launchpad.net

Description of the change

Hello,

Fixed the issue of default_focus="1" not working for widget TextHtml.

Also added monkey patch as focus called after timeout, editor.$frame[0].contentWindow comes undefined when it is called after specified time interval so it was breaking and throwing error(to face this issue remove patch of library and go to view where TextHtml has default focus and just reload whole page, it will throw error as editor.$frame[0].contentWindow is undefined).

Thanks.

To post a comment you must log in.

Unmerged revisions

3905. By Mohammed Shekha<email address hidden>

[FIX]Fixed the issue of focus on cleditor.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/lib/cleditor/jquery.cleditor.js'
2--- addons/web/static/lib/cleditor/jquery.cleditor.js 2013-01-09 16:46:26 +0000
3+++ addons/web/static/lib/cleditor/jquery.cleditor.js 2013-04-19 10:50:51 +0000
4@@ -742,6 +742,8 @@
5 // focus - sets focus to either the textarea or iframe
6 function focus(editor) {
7 setTimeout(function() {
8+ //Monkey patch: Focus breaks on reload whole page
9+ if(!(sourceMode(editor) || editor.$frame[0].contentWindow)) return;
10 if (sourceMode(editor)) editor.$area.focus();
11 else editor.$frame[0].contentWindow.focus();
12 refreshButtons(editor);
13
14=== modified file 'addons/web/static/src/js/view_form.js'
15--- addons/web/static/src/js/view_form.js 2013-04-11 16:32:38 +0000
16+++ addons/web/static/src/js/view_form.js 2013-04-19 10:50:51 +0000
17@@ -2720,6 +2720,9 @@
18 });
19 }
20 },
21+ focus: function() {
22+ this.$cleditor.focus();
23+ },
24 render_value: function() {
25 if (! this.get("effective_readonly")) {
26 this.$textarea.val(this.get('value') || '');