misc fixes

This commit is contained in:
Alex Yatskov 2017-03-04 20:27:46 -08:00
parent 5daf2accf4
commit 6b6190ade7
3 changed files with 13 additions and 13 deletions

View File

@ -302,7 +302,7 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
return " <a href=\"#\" title=\"Add Kanji\" class=\"action-add-note pending disabled\" data-mode=\"kanji\" data-index=\"" return " <a href=\"#\" title=\"Add Kanji\" class=\"action-add-note pending disabled\" data-mode=\"kanji\" data-index=\""
+ container.escapeExpression(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"index","hash":{},"data":data}) : helper))) + container.escapeExpression(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"index","hash":{},"data":data}) : helper)))
+ "\"><img src=\"/mixed/img/add_kanji.png\"></a>\n"; + "\"><img src=\"/mixed/img/add-kanji.png\"></a>\n";
},"4":function(container,depth0,helpers,partials,data) { },"4":function(container,depth0,helpers,partials,data) {
var stack1; var stack1;

View File

@ -119,8 +119,17 @@ function docImposterHide() {
} }
function docRangeFromPoint(point, imposter) { function docRangeFromPoint(point, imposter) {
if (!document.elementFromPoint) { const element = document.elementFromPoint(point.x, point.y);
document.elementFromPoint = (x, y) => { if (element !== null) {
if (element.nodeName === 'IMG' || element.nodeName === 'BUTTON') {
return new TextSourceElement(element);
} else if (imposter && (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA')) {
docImposterCreate(element);
}
}
if (!document.caretRangeFromPoint) {
document.caretRangeFromPoint = (x, y) => {
const position = document.caretPositionFromPoint(x,y); const position = document.caretPositionFromPoint(x,y);
if (position === null) { if (position === null) {
return null; return null;
@ -133,15 +142,6 @@ function docRangeFromPoint(point, imposter) {
}; };
} }
const element = document.elementFromPoint(point.x, point.y);
if (element !== null) {
if (element.nodeName === 'IMG' || element.nodeName === 'BUTTON') {
return new TextSourceElement(element);
} else if (imposter && (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA')) {
docImposterCreate(element);
}
}
const range = document.caretRangeFromPoint(point.x, point.y); const range = document.caretRangeFromPoint(point.x, point.y);
if (range !== null) { if (range !== null) {
docImposterHide(); docImposterHide();

View File

@ -2,7 +2,7 @@
<p> <p>
<div class="actions"> <div class="actions">
{{#if addable}} {{#if addable}}
<a href="#" title="Add Kanji" class="action-add-note pending disabled" data-mode="kanji" data-index="{{@index}}"><img src="/mixed/img/add_kanji.png"></a> <a href="#" title="Add Kanji" class="action-add-note pending disabled" data-mode="kanji" data-index="{{@index}}"><img src="/mixed/img/add-kanji.png"></a>
{{/if}} {{/if}}
</div> </div>