Commit ee9b09a8 authored by Sean Roberts's avatar Sean Roberts Committed by GitHub

Merge branch 'master' into crossframe-sidebar-hide-show

parents 1cf2b0a4 2f01e455
...@@ -4,6 +4,16 @@ Entries in this change log follow the format suggested at http://keepachangelog. ...@@ -4,6 +4,16 @@ Entries in this change log follow the format suggested at http://keepachangelog.
# Change Log # Change Log
## [1.24.0] - 2017-06-26
### Changed
- Enable feature flagging in the annotation layer
([#440](https://github.com/hypothesis/client/pull/440)).
- Fix sidebar app failing to load in Firefox extension.
([#460](https://github.com/hypothesis/client/pull/460)).
## [1.23.0] - 2017-06-19 ## [1.23.0] - 2017-06-19
### Changed ### Changed
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"name": "hypothesis", "name": "hypothesis",
"version": "1.23.0", "version": "1.24.0",
"description": "Annotate with anyone, anywhere.", "description": "Annotate with anyone, anywhere.",
"license": "BSD-2-Clause", "license": "BSD-2-Clause",
"homepage": "https://hypothes.is", "homepage": "https://hypothes.is",
......
...@@ -14,7 +14,7 @@ module.exports = { ...@@ -14,7 +14,7 @@ module.exports = {
init: function(crossframe) { init: function(crossframe) {
crossframe.on(events.FEATURE_FLAGS_UPDATED, _set); crossframe.on(events.FEATURE_FLAGS_UPDATED, _set);
}, },
reset: function() { reset: function() {
_set({}); _set({});
}, },
......
$ = require('jquery') $ = require('jquery')
# Public: Wraps the DOM Nodes within the provided range with a highlight # Public: Wraps the DOM Nodes within the provided range with a highlight
# element of the specified class and returns the highlight Elements. # element of the specified class and returns the highlight Elements.
# #
......
Range = require('../anchoring/range') Range = require('../../anchoring/range')
$ = require('jquery') $ = require('jquery')
highlighter = require('../highlighter') highlighter = require('./index')
describe "highlightRange", -> describe "highlightRange", ->
it 'wraps a highlight span around the given range', -> it 'wraps a highlight span around the given range', ->
......
'use strict';
const domWrapHighlighter = require('./dom-wrap-highlighter');
const overlayHighlighter = require('./overlay-highlighter');
const features = require('../features');
// we need a facade for the highlighter interface
// that will let us lazy check the overlay_highlighter feature
// flag and later determine which interface should be used.
const highlighterFacade = {};
let overlayFlagEnabled;
Object.keys(domWrapHighlighter).forEach((methodName)=>{
highlighterFacade[methodName] = (...args)=>{
// lazy check the value but we will
// use that first value as the rule throughout
// the in memory session
if(overlayFlagEnabled === undefined){
overlayFlagEnabled = features.flagEnabled('overlay_highlighter');
}
const method = overlayFlagEnabled ? overlayHighlighter[methodName] : domWrapHighlighter[methodName];
return method.apply(null, args);
};
});
module.exports = highlighterFacade;
'use strict';
module.exports = {
highlightRange: () => {
// eslint-disable-next-line no-console
console.log('highlightRange not implemented');
},
removeHighlights: () => {
// eslint-disable-next-line no-console
console.log('removeHighlights not implemented');
},
getBoundingClientRect: () => {
// eslint-disable-next-line no-console
console.log('getBoundingClientRect not implemented');
},
};
...@@ -51,6 +51,7 @@ module.exports = class Sidebar extends Host ...@@ -51,6 +51,7 @@ module.exports = class Sidebar extends Host
_setupSidebarEvents: -> _setupSidebarEvents: ->
annotationCounts(document.body, @crossframe) annotationCounts(document.body, @crossframe)
sidebarTrigger(document.body, => this.show()) sidebarTrigger(document.body, => this.show())
features.init(@crossframe)
@crossframe.on('showSidebar', => this.show()) @crossframe.on('showSidebar', => this.show())
@crossframe.on('hideSidebar', => this.hide()) @crossframe.on('hideSidebar', => this.hide())
......
...@@ -58,6 +58,8 @@ describe 'Guest', -> ...@@ -58,6 +58,8 @@ describe 'Guest', ->
return new Guest(element, config) return new Guest(element, config)
beforeEach -> beforeEach ->
sinon.stub(console, 'warn')
FakeAdder::instance = null FakeAdder::instance = null
rangeUtil = { rangeUtil = {
isSelectionBackwards: sinon.stub() isSelectionBackwards: sinon.stub()
...@@ -94,6 +96,7 @@ describe 'Guest', -> ...@@ -94,6 +96,7 @@ describe 'Guest', ->
afterEach -> afterEach ->
sandbox.restore() sandbox.restore()
console.warn.restore()
describe 'plugins', -> describe 'plugins', ->
fakePlugin = null fakePlugin = null
......
...@@ -54,6 +54,7 @@ describe('anchoring', function () { ...@@ -54,6 +54,7 @@ describe('anchoring', function () {
}); });
beforeEach(function () { beforeEach(function () {
sinon.stub(console, 'warn');
container = document.createElement('div'); container = document.createElement('div');
container.innerHTML = require('./test-page.html'); container.innerHTML = require('./test-page.html');
document.body.appendChild(container); document.body.appendChild(container);
...@@ -63,6 +64,7 @@ describe('anchoring', function () { ...@@ -63,6 +64,7 @@ describe('anchoring', function () {
afterEach(function () { afterEach(function () {
guest.destroy(); guest.destroy();
container.parentNode.removeChild(container); container.parentNode.removeChild(container);
console.warn.restore();
}); });
unroll('should highlight #tag when annotations are loaded', function (testCase) { unroll('should highlight #tag when annotations are loaded', function (testCase) {
......
...@@ -225,5 +225,16 @@ module.exports = angular.module('h', [ ...@@ -225,5 +225,16 @@ module.exports = angular.module('h', [
processAppOpts(); processAppOpts();
// Work around a check in Angular's $sniffer service that causes it to
// incorrectly determine that Firefox extensions are Chrome Packaged Apps which
// do not support the HTML 5 History API. This results Angular redirecting the
// browser on startup and thus the app fails to load.
// See https://github.com/angular/angular.js/blob/a03b75c6a812fcc2f616fc05c0f1710e03fca8e9/src/ng/sniffer.js#L30
if (window.chrome && !window.chrome.app) {
window.chrome.app = {
dummyAddedByHypothesisClient: true,
};
}
var appEl = document.querySelector('hypothesis-app'); var appEl = document.querySelector('hypothesis-app');
angular.bootstrap(appEl, ['h'], {strictDi: true}); angular.bootstrap(appEl, ['h'], {strictDi: true});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment