fixed anchor bug

This commit is contained in:
Galen Wolfe-Pauly 2015-09-21 13:00:58 -07:00
parent 09c6d28d6b
commit c61293fb44
2 changed files with 39 additions and 53 deletions

View File

@ -52,13 +52,13 @@ module.exports = query {body:'r'}, recl
componentWillUnmount: ->
clearInterval @int
collectHeaders: (e) ->
hs = [{gn:"h1", ga:{className:"t"}, c:["Table of contents"]}]
for k,v of e
if not v.gn then continue
if v.gn[0] is 'h' and parseInt(v.gn[1]) isnt NaN
_v = _.clone v
delete _v.ga.id
hs.push v
return hs
@ -68,4 +68,4 @@ module.exports = query {body:'r'}, recl
if v.gn is 'div' and v.ga?.id is "toc"
return {gn:"div", ga:{className:"toc",onClick:@_click}, c:@collectHeaders(v.c)}
render: -> reactify @parseHeaders()
render: -> reactify @parseHeaders()

View File

@ -35,7 +35,6 @@ module.exports = {
};
},{"../dispatcher/Dispatcher.coffee":13,"../persistence/TreePersistence.coffee":19}],2:[function(require,module,exports){
var BodyComponent, CLICK, Links, TreeActions, TreeStore, a, clas, div, query, reactify, recl, ref;
@ -289,7 +288,6 @@ module.exports = query({
}));
},{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":20,"./Async.coffee":3,"./BodyComponent.coffee":4,"./Reactify.coffee":10,"classnames":15}],3:[function(require,module,exports){
var TreeActions, TreeStore, _load, code, div, recl, ref, span;
@ -391,7 +389,6 @@ module.exports = function(queries, Child, load) {
};
},{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":20,"./LoadComponent.coffee":9}],4:[function(require,module,exports){
var div, query, reactify, recl;
@ -417,7 +414,6 @@ module.exports = query({
}));
},{"./Async.coffee":3,"./Reactify.coffee":10}],5:[function(require,module,exports){
var div, recl, ref, textarea;
@ -441,7 +437,6 @@ module.exports = recl({
});
},{}],6:[function(require,module,exports){
var div, recl;
@ -463,7 +458,6 @@ module.exports = {
};
},{"./CodeMirror.coffee":5,"./KidsComponent.coffee":7,"./ListComponent.coffee":8,"./SearchComponent.coffee":11,"./TocComponent.coffee":12}],7:[function(require,module,exports){
var a, div, hr, li, query, reactify, recl, ref, ul;
@ -503,7 +497,6 @@ module.exports = query({
}));
},{"./Async.coffee":3,"./Reactify.coffee":10}],8:[function(require,module,exports){
var a, clas, div, h1, li, query, reactify, recl, ref, ul;
@ -599,7 +592,6 @@ module.exports = query({
}));
},{"./Async.coffee":3,"./Reactify.coffee":10,"classnames":15}],9:[function(require,module,exports){
var div, input, recl, ref, textarea;
@ -640,7 +632,6 @@ module.exports = recl({
});
},{}],10:[function(require,module,exports){
var Virtual, div, load, reactify, recl, ref, rele, span, walk;
@ -708,7 +699,6 @@ module.exports = _.extend(reactify, {
});
},{"./LoadComponent.coffee":9}],11:[function(require,module,exports){
var a, div, input, query, reactify, recl, ref,
slice = [].slice;
@ -847,7 +837,6 @@ module.exports = query({
}));
},{"./Async.coffee":3,"./Reactify.coffee":10}],12:[function(require,module,exports){
var div, query, reactify, recl;
@ -932,7 +921,7 @@ module.exports = query({
return clearInterval(this.int);
},
collectHeaders: function(e) {
var hs, k, v;
var _v, hs, k, v;
hs = [
{
gn: "h1",
@ -948,6 +937,8 @@ module.exports = query({
continue;
}
if (v.gn[0] === 'h' && parseInt(v.gn[1]) !== NaN) {
_v = _.clone(v);
delete _v.ga.id;
hs.push(v);
}
}
@ -978,7 +969,6 @@ module.exports = query({
}));
},{"./Async.coffee":3,"./Reactify.coffee":10}],13:[function(require,module,exports){
var Dispatcher;
@ -1000,7 +990,6 @@ module.exports = _.extend(new Dispatcher(), {
});
},{"flux":16}],14:[function(require,module,exports){
var rend;
@ -1147,7 +1136,6 @@ $(function() {
});
},{"./actions/TreeActions.coffee":1,"./components/AnchorComponent.coffee":2,"./components/BodyComponent.coffee":4,"./components/Components.coffee":6,"./persistence/TreePersistence.coffee":19}],15:[function(require,module,exports){
/*!
Copyright (c) 2015 Jed Watson.
@ -1156,46 +1144,46 @@ $(function() {
*/
(function () {
'use strict';
'use strict';
function classNames () {
function classNames () {
var classes = '';
var classes = '';
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
var argType = typeof arg;
if ('string' === argType || 'number' === argType) {
classes += ' ' + arg;
if ('string' === argType || 'number' === argType) {
classes += ' ' + arg;
} else if (Array.isArray(arg)) {
classes += ' ' + classNames.apply(null, arg);
} else if (Array.isArray(arg)) {
classes += ' ' + classNames.apply(null, arg);
} else if ('object' === argType) {
for (var key in arg) {
if (arg.hasOwnProperty(key) && arg[key]) {
classes += ' ' + key;
}
}
}
}
} else if ('object' === argType) {
for (var key in arg) {
if (arg.hasOwnProperty(key) && arg[key]) {
classes += ' ' + key;
}
}
}
}
return classes.substr(1);
}
return classes.substr(1);
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd){
// AMD. Register as an anonymous module.
define(function () {
return classNames;
});
} else {
window.classNames = classNames;
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd){
// AMD. Register as an anonymous module.
define(function () {
return classNames;
});
} else {
window.classNames = classNames;
}
}());
@ -1535,7 +1523,7 @@ module.exports = {
encode: function(obj) {
var _encode, delim;
delim = function(n) {
return Array(n + 1).join('_') || '.';
return ('_'.repeat(n)) || '.';
};
_encode = function(obj) {
var _dep, dep, k, res, sub, v;
@ -1568,7 +1556,6 @@ module.exports = {
};
},{}],20:[function(require,module,exports){
var EventEmitter, MessageDispatcher, QUERIES, TreeStore, _curr, _data, _tree, clog;
@ -1804,7 +1791,6 @@ TreeStore.dispatchToken = MessageDispatcher.register(function(payload) {
module.exports = TreeStore;
},{"../dispatcher/Dispatcher.coffee":13,"events":21}],21:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
@ -2108,4 +2094,4 @@ function isUndefined(arg) {
return arg === void 0;
}
},{}]},{},[14]);
},{}]},{},[14]);