Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/annotate.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@ version="3.0">
<xsl:function name="rdfae:selection-valid" as="xs:boolean">
<xsl:param name="range"/>

<xsl:variable name="start" select="ixsl:get($range, 'startContainer')"/>
<xsl:variable name="end" select="ixsl:get($range, 'endContainer')"/>
<xsl:sequence select="ixsl:call($start, 'isSameNode', [ $end ])
or (ixsl:get($start, 'nodeType') = 3 and ixsl:get($end, 'nodeType') = 3
and ixsl:call(ixsl:get($start, 'parentNode'), 'isSameNode', [ ixsl:get($end, 'parentNode') ]))"/>
<xsl:variable name="start" select="ixsl:get($range, 'startContainer')" as="node()?"/>
<xsl:variable name="end" select="ixsl:get($range, 'endContainer')" as="node()?"/>
<xsl:sequence select="$start is $end
or ($start instance of text() and $end instance of text() and $start/.. is $end/..)"/>
</xsl:function>

<!-- the single write path for RDFa attributes, shared by create and edit. No modes:
Expand Down Expand Up @@ -187,7 +186,7 @@ version="3.0">
<xsl:template name="rdfae:unwrap-element">
<xsl:param name="element" as="element()"/>

<xsl:variable name="parent" select="ixsl:get($element, 'parentNode')"/>
<xsl:variable name="parent" select="$element/.." as="node()"/>
<xsl:for-each select="1 to xs:integer(ixsl:get($element, 'childNodes.length'))">
<xsl:sequence select="ixsl:call($parent, 'insertBefore', [ ixsl:get($element, 'firstChild'), $element ])[current-date() lt xs:date('2000-01-01')]"/>
</xsl:for-each>
Expand Down Expand Up @@ -351,7 +350,8 @@ version="3.0">

<!-- clicking the backdrop (not the content) closes the modal -->
<xsl:template match="div[@id = 'output-modal']" mode="ixsl:onclick">
<xsl:if test="ixsl:call(ixsl:get(ixsl:event(), 'target'), 'isSameNode', [ . ])">
<xsl:variable name="target" select="ixsl:get(ixsl:event(), 'target')" as="node()?"/>
<xsl:if test="$target is .">
<ixsl:set-style name="display" select="'none'"/>
</xsl:if>
</xsl:template>
Expand Down
7 changes: 4 additions & 3 deletions src/edit.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,8 @@ version="3.0">
<xsl:variable name="key" as="xs:string" select="string(ixsl:get($event, 'key'))"/>
<xsl:variable name="chord" as="xs:boolean"
select="(ixsl:get($event, 'ctrlKey') or ixsl:get($event, 'metaKey')) and not(ixsl:get($event, 'altKey'))"/>
<xsl:if test="ixsl:call(ixsl:get($event, 'target'), 'isSameNode', [ . ])">
<xsl:variable name="target" select="ixsl:get($event, 'target')" as="node()?"/>
<xsl:if test="$target is .">
<xsl:choose>
<xsl:when test="$chord and lower-case($key) = 'z' and not(ixsl:get($event, 'shiftKey'))">
<xsl:sequence select="ixsl:call($event, 'preventDefault', [])[current-date() lt xs:date('2000-01-01')]"/>
Expand Down Expand Up @@ -1193,7 +1194,7 @@ version="3.0">

<xsl:sequence select="ixsl:call($range, 'insertNode', [ $node ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:call-template name="rdfae:place-caret">
<xsl:with-param name="node" select="ixsl:get($node, 'parentNode')"/>
<xsl:with-param name="node" select="$node/.."/>
<xsl:with-param name="offset" select="count($node/preceding-sibling::node()) + 1"/>
</xsl:call-template>
</xsl:template>
Expand Down Expand Up @@ -1710,7 +1711,7 @@ version="3.0">
<xsl:sequence select="ixsl:call($range, 'insertNode', [ $fragment ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:for-each select="$last">
<xsl:call-template name="rdfae:place-caret">
<xsl:with-param name="node" select="ixsl:get(., 'parentNode')"/>
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="offset" select="count(preceding-sibling::node()) + 1"/>
</xsl:call-template>
</xsl:for-each>
Expand Down
2 changes: 1 addition & 1 deletion src/index.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ version="3.0">
LinkedDataHub's window.LinkedDataHub); reached everywhere via rdfae:editor-state().
Hosts with their own initial template call this from there instead of main -->
<xsl:template name="rdfae:init-state">
<xsl:variable name="state" select="ixsl:call(ixsl:window(), 'Object', [])"/>
<xsl:variable name="state" select="ixsl:new('Object', [])"/>
<ixsl:set-property name="rdfaEditor" select="$state" object="ixsl:window()"/>
<xsl:for-each select="('editingSpan', 'range', 'activeBlock', 'draggedBlock',
'editRange', 'editingLink', 'insertHost', 'lastUndoHost',
Expand Down
2 changes: 1 addition & 1 deletion src/navigate.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ version="3.0">
<xsl:sequence select="ixsl:call(rdfae:selection(),
'setBaseAndExtent', [ $node, $position - 1, $node,
$position - 1 + string-length($query) ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get($node, 'parentElement'), 'scrollIntoView',
<xsl:sequence select="ixsl:call($node/parent::*, 'scrollIntoView',
[ map{ 'block': 'center' } ])[current-date() lt xs:date('2000-01-01')]"/>
<ixsl:set-property name="findNode" select="$node" object="rdfae:editor-state()"/>
<ixsl:set-property name="findOffset"
Expand Down
4 changes: 1 addition & 3 deletions src/typeahead.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,7 @@ version="3.0">
</xsl:for-each>
<xsl:for-each select="$items[$next]">
<ixsl:set-attribute name="aria-selected" select="'true'"/>
<xsl:variable name="opts" select="ixsl:call(ixsl:window(), 'Object', [])"/>
<ixsl:set-property name="block" select="'nearest'" object="$opts"/>
<xsl:sequence select="ixsl:call(., 'scrollIntoView', [ $opts ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(., 'scrollIntoView', [ map{ 'block': 'nearest' } ])[current-date() lt xs:date('2000-01-01')]"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise/>
Expand Down
Loading