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; }
|
html { background: %s; }
|
||||||
#topbutsOuter { background: %s; }
|
#topbutsOuter { background: %s; }
|
||||||
</style>
|
</style>
|
||||||
<div id="topbutsOuter"><div id="topbuts" class="clearfix">%s</div></div>
|
<div id="topbutsOuter">
|
||||||
<div id="fields"></div>
|
<div id="topbuts" class="clearfix">
|
||||||
<div id="dupes" style="display:none;"><a href="#" onclick="pycmd('dupes');return false;">%s</a></div>
|
%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
|
# 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
|
# The color selection buttons do not use an icon so the HTML must be specified manually
|
||||||
tip = _("Set foreground colour (F7)")
|
tip = _("Set foreground colour (F7)")
|
||||||
righttopbtns.append(
|
righttopbtns.append(
|
||||||
"""<button tabindex=-1 class=linkb title="{}"
|
""" <button tabindex=-1
|
||||||
type="button" onclick="pycmd('colour');return false;">
|
class=linkb
|
||||||
<div id=forecolor style="display:inline-block; background: #000;border-radius: 5px;"
|
title="{}"
|
||||||
class=topbut></div></button>""".format(
|
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
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
tip = _("Change colour (F8)")
|
tip = _("Change colour (F8)")
|
||||||
righttopbtns.extend(
|
righttopbtns.extend(
|
||||||
[
|
[
|
||||||
"""<button tabindex=-1 class=linkb title="{}"
|
"""<button tabindex=-1
|
||||||
type="button" onclick="pycmd('changeCol');return false;">
|
class=linkb
|
||||||
<div style="display:inline-block; border-radius: 5px;"
|
title="{}"
|
||||||
class="topbut rainbow"></div></button>""".format(
|
type="button"
|
||||||
|
onclick="pycmd('changeCol');return false;"
|
||||||
|
>
|
||||||
|
<div style="display:inline-block; border-radius: 5px;"
|
||||||
|
class="topbut rainbow"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</button>""".format(
|
||||||
tip
|
tip
|
||||||
),
|
),
|
||||||
self._addButton(
|
self._addButton(
|
||||||
@ -249,18 +273,23 @@ class Editor:
|
|||||||
theclass = "linkb"
|
theclass = "linkb"
|
||||||
if not disables:
|
if not disables:
|
||||||
theclass += " perm"
|
theclass += " perm"
|
||||||
return (
|
return """ <button tabindex=-1
|
||||||
'''<button tabindex=-1 {id} class="{theclass}" type="button" title="{tip}"'''
|
{id}
|
||||||
""" onclick="pycmd('{cmd}');{togglesc}return false;">"""
|
class="{theclass}"
|
||||||
"""{imgelm}{labelelm}</button>""".format(
|
type="button"
|
||||||
imgelm=imgelm,
|
title="{tip}"
|
||||||
cmd=cmd,
|
onclick="pycmd('{cmd}');{togglesc}return false;"
|
||||||
tip=tip,
|
>
|
||||||
labelelm=labelelm,
|
{imgelm}
|
||||||
id=idstr,
|
{labelelm}
|
||||||
togglesc=toggleScript,
|
</button>""".format(
|
||||||
theclass=theclass,
|
imgelm=imgelm,
|
||||||
)
|
cmd=cmd,
|
||||||
|
tip=tip,
|
||||||
|
labelelm=labelelm,
|
||||||
|
id=idstr,
|
||||||
|
togglesc=toggleScript,
|
||||||
|
theclass=theclass,
|
||||||
)
|
)
|
||||||
|
|
||||||
def setupShortcuts(self) -> None:
|
def setupShortcuts(self) -> None:
|
||||||
|
@ -333,20 +333,35 @@ function setFields(fields) {
|
|||||||
if (!f) {
|
if (!f) {
|
||||||
f = "<br>";
|
f = "<br>";
|
||||||
}
|
}
|
||||||
txt += `<tr><td class=fname>${n}</td></tr><tr><td width=100%>`;
|
txt += `
|
||||||
txt += `<div id=f${i} onkeydown='onKey(window.event);' oninput='onInput()' onmouseup='onKey(window.event);'`;
|
<tr>
|
||||||
txt +=
|
<td class=fname>${n}</td>
|
||||||
" onfocus='onFocus(this);' onblur='onBlur();' class='field clearfix' ";
|
</tr>
|
||||||
txt += "ondragover='onDragOver(this);' onpaste='onPaste(this);' ";
|
<tr>
|
||||||
txt += "oncopy='onCutOrCopy(this);' oncut='onCutOrCopy(this);' ";
|
<td width=100%>
|
||||||
txt += `contentEditable=true class=field>${f}</div>`;
|
<div id=f${i}
|
||||||
txt += "</td></tr>";
|
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(
|
$("#fields").html(`
|
||||||
"<table cellpadding=0 width=100% style='table-layout: fixed;'>" +
|
<table cellpadding=0 width=100% style='table-layout: fixed;'>
|
||||||
txt +
|
${txt}
|
||||||
"</table>"
|
</table>`);
|
||||||
);
|
|
||||||
maybeDisableButtons();
|
maybeDisableButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user