Ident html in editor
Sometime I like to print html to understand why it bugs. And I really prefer to have html indented if it's okay with you. There is no change appart from the identation and quotes
This commit is contained in:
parent
75b7ebb156
commit
349d145014
@ -63,9 +63,18 @@ _html = """
|
||||
html { background: %s; }
|
||||
#topbutsOuter { background: %s; }
|
||||
</style>
|
||||
<div id="topbutsOuter"><div id="topbuts" class="clearfix">%s</div></div>
|
||||
<div id="fields"></div>
|
||||
<div id="dupes" style="display:none;"><a href="#" onclick="pycmd('dupes');return false;">%s</a></div>
|
||||
<div id="topbutsOuter">
|
||||
<div id="topbuts" class="clearfix">
|
||||
%s
|
||||
</div>
|
||||
</div>
|
||||
<div id="fields">
|
||||
</div>
|
||||
<div id="dupes" style="display:none;">
|
||||
<a href="#" onclick="pycmd('dupes');return false;">
|
||||
%s
|
||||
</a>
|
||||
</div>
|
||||
"""
|
||||
|
||||
# caller is responsible for resetting note on reset
|
||||
@ -117,20 +126,35 @@ class Editor:
|
||||
# The color selection buttons do not use an icon so the HTML must be specified manually
|
||||
tip = _("Set foreground colour (F7)")
|
||||
righttopbtns.append(
|
||||
"""<button tabindex=-1 class=linkb title="{}"
|
||||
type="button" onclick="pycmd('colour');return false;">
|
||||
<div id=forecolor style="display:inline-block; background: #000;border-radius: 5px;"
|
||||
class=topbut></div></button>""".format(
|
||||
""" <button tabindex=-1
|
||||
class=linkb
|
||||
title="{}"
|
||||
type="button"
|
||||
onclick="pycmd('colour'); return false;"
|
||||
>
|
||||
<div id=forecolor
|
||||
style="display:inline-block; background: #000;border-radius: 5px;"
|
||||
class=topbut
|
||||
>
|
||||
</div>
|
||||
</button>""".format(
|
||||
tip
|
||||
)
|
||||
)
|
||||
tip = _("Change colour (F8)")
|
||||
righttopbtns.extend(
|
||||
[
|
||||
"""<button tabindex=-1 class=linkb title="{}"
|
||||
type="button" onclick="pycmd('changeCol');return false;">
|
||||
<div style="display:inline-block; border-radius: 5px;"
|
||||
class="topbut rainbow"></div></button>""".format(
|
||||
"""<button tabindex=-1
|
||||
class=linkb
|
||||
title="{}"
|
||||
type="button"
|
||||
onclick="pycmd('changeCol');return false;"
|
||||
>
|
||||
<div style="display:inline-block; border-radius: 5px;"
|
||||
class="topbut rainbow"
|
||||
>
|
||||
</div>
|
||||
</button>""".format(
|
||||
tip
|
||||
),
|
||||
self._addButton(
|
||||
@ -249,18 +273,23 @@ class Editor:
|
||||
theclass = "linkb"
|
||||
if not disables:
|
||||
theclass += " perm"
|
||||
return (
|
||||
'''<button tabindex=-1 {id} class="{theclass}" type="button" title="{tip}"'''
|
||||
""" onclick="pycmd('{cmd}');{togglesc}return false;">"""
|
||||
"""{imgelm}{labelelm}</button>""".format(
|
||||
imgelm=imgelm,
|
||||
cmd=cmd,
|
||||
tip=tip,
|
||||
labelelm=labelelm,
|
||||
id=idstr,
|
||||
togglesc=toggleScript,
|
||||
theclass=theclass,
|
||||
)
|
||||
return """ <button tabindex=-1
|
||||
{id}
|
||||
class="{theclass}"
|
||||
type="button"
|
||||
title="{tip}"
|
||||
onclick="pycmd('{cmd}');{togglesc}return false;"
|
||||
>
|
||||
{imgelm}
|
||||
{labelelm}
|
||||
</button>""".format(
|
||||
imgelm=imgelm,
|
||||
cmd=cmd,
|
||||
tip=tip,
|
||||
labelelm=labelelm,
|
||||
id=idstr,
|
||||
togglesc=toggleScript,
|
||||
theclass=theclass,
|
||||
)
|
||||
|
||||
def setupShortcuts(self) -> None:
|
||||
|
@ -333,20 +333,35 @@ function setFields(fields) {
|
||||
if (!f) {
|
||||
f = "<br>";
|
||||
}
|
||||
txt += `<tr><td class=fname>${n}</td></tr><tr><td width=100%>`;
|
||||
txt += `<div id=f${i} onkeydown='onKey(window.event);' oninput='onInput()' onmouseup='onKey(window.event);'`;
|
||||
txt +=
|
||||
" onfocus='onFocus(this);' onblur='onBlur();' class='field clearfix' ";
|
||||
txt += "ondragover='onDragOver(this);' onpaste='onPaste(this);' ";
|
||||
txt += "oncopy='onCutOrCopy(this);' oncut='onCutOrCopy(this);' ";
|
||||
txt += `contentEditable=true class=field>${f}</div>`;
|
||||
txt += "</td></tr>";
|
||||
txt += `
|
||||
<tr>
|
||||
<td class=fname>${n}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=100%>
|
||||
<div id=f${i}
|
||||
onkeydown='onKey(window.event);'
|
||||
oninput='onInput();'
|
||||
onmouseup='onKey(window.event);'
|
||||
onfocus='onFocus(this);'
|
||||
onblur='onBlur();'
|
||||
class='field clearfix'
|
||||
ondragover='onDragOver(this);'
|
||||
onpaste='onPaste(this);'
|
||||
oncopy='onCutOrCopy(this);'
|
||||
oncut='onCutOrCopy(this);'
|
||||
contentEditable=true
|
||||
class=field
|
||||
>
|
||||
${f}
|
||||
</div>
|
||||
</td>
|
||||
</tr>`;
|
||||
}
|
||||
$("#fields").html(
|
||||
"<table cellpadding=0 width=100% style='table-layout: fixed;'>" +
|
||||
txt +
|
||||
"</table>"
|
||||
);
|
||||
$("#fields").html(`
|
||||
<table cellpadding=0 width=100% style='table-layout: fixed;'>
|
||||
${txt}
|
||||
</table>`);
|
||||
maybeDisableButtons();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user