Fixes errors with Mike's-DevU.kmx keyboard in Keyman Configuration, and bonus improves script error dialog a smidge

This commit is contained in:
Marc Durdin 2018-03-07 15:46:12 +07:00
parent e43395af72
commit 0a72e00a1a
6 changed files with 61 additions and 16 deletions

View file

@ -189,9 +189,9 @@ document.addEventListener("DOMContentLoaded", windowResize);
}
function list_detail(event,n) {
var k = $('#list_'+n);
k.toggleClass('expanded');
document.getElementById('list_'+n).focus();
var k = document.getElementById('list_'+n);
$(k).toggleClass('expanded');
k.focus();
save_state();
return false;
}

View file

@ -160,4 +160,27 @@
</xsl:template>
<!-- Replaces a string, e.g. ' with \' https://stackoverflow.com/a/7712434/1836776 -->
<xsl:template name="replace-string">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="with"/>
<xsl:choose>
<xsl:when test="contains($text,$replace)">
<xsl:value-of select="substring-before($text,$replace)"/>
<xsl:value-of select="$with"/>
<xsl:call-template name="replace-string">
<xsl:with-param name="text"
select="substring-after($text,$replace)"/>
<xsl:with-param name="replace" select="$replace"/>
<xsl:with-param name="with" select="$with"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View file

@ -35,7 +35,7 @@
<xsl:sort select="name" />
<div class="item">
<xsl:attribute name="id">package_<xsl:value-of select="id"/></xsl:attribute>
<xsl:attribute name="id">package_<xsl:value-of select="id" /></xsl:attribute>
<img class="list_icon">
<xsl:attribute name="src"><xsl:value-of select="/Keyman/templatepath"/>package.gif</xsl:attribute>
@ -71,19 +71,31 @@
<xsl:template name="keyboard">
<xsl:param name="singlekeyboardpackage" />
<xsl:variable name="id"><xsl:call-template name="replace-string">
<xsl:with-param name="text" select="id" />
<xsl:with-param name="replace" select='"&apos;"' />
<xsl:with-param name="with" select='"\&apos;"' />
</xsl:call-template></xsl:variable>
<xsl:variable name="package_id"><xsl:call-template name="replace-string">
<xsl:with-param name="text" select="../../id"/>
<xsl:with-param name="replace" select='"&apos;"' />
<xsl:with-param name="with" select='"\&apos;"' />
</xsl:call-template></xsl:variable>
<div tabindex="1" tagType="listitem">
<xsl:attribute name="class">list_item</xsl:attribute>
<xsl:attribute name="id">list_keyboard_<xsl:value-of select="id"/></xsl:attribute>
<xsl:attribute name="data-name"><xsl:value-of select="name"/></xsl:attribute>
<xsl:attribute name="onkeydown">return list_keydown(event,'keyboard_<xsl:value-of select="id"/>');</xsl:attribute>
<xsl:attribute name="onfocus">return list_focus(event,'keyboard_<xsl:value-of select="id"/>');</xsl:attribute>
<xsl:attribute name="onblur">return list_blur(event,'keyboard_<xsl:value-of select="id"/>');</xsl:attribute>
<xsl:attribute name="onkeydown">return list_keydown(event,'keyboard_<xsl:value-of select="$id"/>');</xsl:attribute>
<xsl:attribute name="onfocus">return list_focus(event,'keyboard_<xsl:value-of select="$id"/>');</xsl:attribute>
<xsl:attribute name="onblur">return list_blur(event,'keyboard_<xsl:value-of select="$id"/>');</xsl:attribute>
<xsl:attribute name="oncontextmenu">event.cancelBubble=true;event.returnValue=false;</xsl:attribute>
<xsl:attribute name="style">left:0;top:0;width:99%</xsl:attribute>
<div>
<xsl:attribute name="onmousedown">return list_detail(event,'keyboard_<xsl:value-of select="id"/>');</xsl:attribute>
<xsl:attribute name="onmousedown">return list_detail(event,'keyboard_<xsl:value-of select="$id"/>');</xsl:attribute>
<xsl:attribute name="id">listtitle_keyboard_<xsl:value-of select="id"/></xsl:attribute>
<xsl:attribute name='class'>
list_title <xsl:choose><xsl:when test='loaded'>keyboard_loaded</xsl:when><xsl:otherwise>keyboard_unloaded</xsl:otherwise></xsl:choose>
@ -92,7 +104,7 @@
<input type='checkbox'>
<xsl:attribute name="id">keyboardcheck_<xsl:value-of select="id"/></xsl:attribute>
<xsl:attribute name='onmousedown'>event.stopPropagation();return false;</xsl:attribute>
<xsl:attribute name='onclick'>return keyboard_checkclick('<xsl:value-of select="id"/>');</xsl:attribute>
<xsl:attribute name='onclick'>return keyboard_checkclick('<xsl:value-of select="$id"/>');</xsl:attribute>
<xsl:if test='loaded'><xsl:attribute name='checked'>checked</xsl:attribute></xsl:if>
</input>
<div class="list_icon">
@ -124,22 +136,22 @@
<div class="list_expand">
<xsl:attribute name="id">list_expand_keyboard_<xsl:value-of select="id"/></xsl:attribute>
</div>
<xsl:choose>
<xsl:when test="//KeymanPackageContentKeyboardsInstalled/KeymanKeyboardInstalled[id=current()/id]">
<div class="list_close">
<xsl:attribute name="id">list_close_keyboard_<xsl:value-of select="id"/></xsl:attribute>
<xsl:attribute name="onmousedown">location.href='keyman:package_uninstall?id=<xsl:value-of select="../../id"/>';event.cancelBubble=true;return false;</xsl:attribute>
<xsl:attribute name="onmousedown">location.href='keyman:package_uninstall?id=<xsl:value-of select="$package_id"/>';event.cancelBubble=true;return false;</xsl:attribute>
</div>
<div class="list_help">
<xsl:attribute name="id">list_help_keyboard_<xsl:value-of select="id"/></xsl:attribute>
<xsl:attribute name="onmousedown">location.href='keyman:package_welcome?id=<xsl:value-of select="../../id" />';event.cancelBubble=true;return false;</xsl:attribute>
<xsl:attribute name="onmousedown">location.href='keyman:package_welcome?id=<xsl:value-of select="$package_id" />';event.cancelBubble=true;return false;</xsl:attribute>
</div>
</xsl:when>
<xsl:otherwise>
<div class="list_close">
<xsl:attribute name="id">list_close_keyboard_<xsl:value-of select="id"/></xsl:attribute>
<xsl:attribute name="onmousedown">location.href='keyman:keyboard_uninstall?id=<xsl:value-of select="id"/>';event.cancelBubble=true;return false;</xsl:attribute>
<xsl:attribute name="onmousedown">location.href='keyman:keyboard_uninstall?id=<xsl:value-of select="$id"/>';event.cancelBubble=true;return false;</xsl:attribute>
</div>
</xsl:otherwise>
</xsl:choose>

View file

@ -73,7 +73,7 @@ object frmScriptError: TfrmScriptError
object chkTellKeymanSupport: TCheckBox
Left = 16
Top = 138
Width = 185
Width = 225
Height = 17
Caption = 'Tell Keyman Support about this error'
Checked = True

View file

@ -18,6 +18,7 @@ inherited frmWebContainer: TfrmWebContainer
Height = 286
Align = alClient
TabOrder = 0
Silent = False
OnBeforeNavigate2 = webBeforeNavigate2
OnDocumentComplete = webDocumentComplete
OnNewWindow3 = webNewWindow3

View file

@ -79,7 +79,8 @@ type
private
FDialogName: WideString;
FXMLRenderers: TXMLRenderers;
FXMLFileName: TTempFile; // I4181
FXMLFileName: TTempFile;
FNoMoreErrors: Boolean; // I4181
procedure WMUser_FormShown(var Message: TMessage); message WM_USER_FormShown;
procedure WMUser_FireCommand(var Message: TMessage); message WM_USER_FireCommand;
procedure WMUser_ContentRender(var Message: TMessage); message WM_USER_ContentRender;
@ -390,9 +391,17 @@ var
FAborting: Boolean;
begin
FAborting := False;
if FNoMoreErrors then
begin
ScriptErrorAction := eaContinue;
Exit;
end;
case ShowScriptErrorDialog(Self, ErrorMessage, FTellKeymanSupport) of // I2992 // I3544
mrYes: ScriptErrorAction := eaContinue;
mrNo: ScriptErrorAction := eaCancel;
mrCancel: begin ScriptErrorAction := eaContinue; FNoMoreErrors := True; end;
mrNo: ScriptErrorAction := eaCancel;
mrAbort: begin ScriptErrorAction := eaCancel; FAborting := True; end;
end;