mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
gfse: more readable layout for not so simple grammars + bug fix
To make definitions that span multiple lines more readable in guided mode, preserve line breaks and indentation when lin and oper definitions are displayed and edited in guided mode. Bug fix: moving the cursor by clicking and selecting text by dragging did not work in textareas and input fields, because those mouse event were intercepted by the sort-by-drag-and-drop handler.
This commit is contained in:
@@ -77,6 +77,9 @@ div.template:hover
|
||||
tr.deletable:hover .delete
|
||||
{ visibility: visible; }
|
||||
|
||||
.editable { white-space: pre; }
|
||||
div.lin span.editable { display: inline-block; vertical-align: top; }
|
||||
|
||||
.more { color: green; }
|
||||
.edit { color: orange; }
|
||||
.delete { color: red; }
|
||||
@@ -110,7 +113,8 @@ table.tabs input[type=button], table.matrixview th input[type=button] {
|
||||
/*text-decoration: underline;*/
|
||||
}
|
||||
|
||||
input.string_edit { font-family: inherit; font-size: inherit; }
|
||||
.string_edit { font-family: inherit; font-size: inherit; }
|
||||
textarea.string_edit { vertical-align: top; }
|
||||
|
||||
ul.languages { -moz-column-width: 20em; }
|
||||
|
||||
|
||||
@@ -1798,9 +1798,16 @@ function string_editor(el,init,ok,async) {
|
||||
e.it.focus();
|
||||
}
|
||||
var m=empty_class("span","error_message");
|
||||
var i=node("input",{"class":"string_edit",name:"it",value:init},[]);
|
||||
if(init.length>10) i.size=init.length+5;
|
||||
// var i=node("textarea",{name:"it",rows:"2",cols:"60"},[text(init)]);
|
||||
if(init.indexOf("\n")>=0) {
|
||||
var rows=init.split("\n").length+1
|
||||
var i=node("textarea",{"class":"string_edit",name:"it",
|
||||
rows:rows,cols:"80"},
|
||||
[text(init)]);
|
||||
}
|
||||
else {
|
||||
var i=node("input",{"class":"string_edit",name:"it",value:init},[]);
|
||||
if(init.length>10) i.size=init.length+5;
|
||||
}
|
||||
var e=node("form",{},
|
||||
[i,
|
||||
text(" "),
|
||||
@@ -1996,7 +2003,8 @@ if(editor) {
|
||||
initial_view();
|
||||
touch_edit();
|
||||
dir_bugfix();
|
||||
initialize_sorting(["DIV"],["fun","lin","lincat","oper"]);
|
||||
initialize_sorting(["DIV","INPUT","TEXTAREA"],
|
||||
["fun","lin","lincat","oper"]);
|
||||
}
|
||||
else
|
||||
editor.innerHTML="<p>This browser does not appear to support localStorage, and the grammar editor does not work without it. Sorry!"
|
||||
|
||||
Reference in New Issue
Block a user