diff --git a/client/editor.js b/client/editor.js index 03fa21ce..2b0c4bfa 100644 --- a/client/editor.js +++ b/client/editor.js @@ -84,8 +84,10 @@ const resetStage = () => { const bindings = { a: () => changeGlyph('getPreviousGlyph'), A: () => changeGlyph('getPreviousUnverifiedGlyph'), + q: () => changeGlyph('getPreviousVerifiedGlyph'), d: () => changeGlyph('getNextGlyph'), D: () => changeGlyph('getNextUnverifiedGlyph'), + e: () => changeGlyph('getNextVerifiedGlyph'), r: resetStage, s: () => incrementStage(1), w: () => incrementStage(-1), diff --git a/lib/glyphs.js b/lib/glyphs.js index 954107e1..8c7eacd6 100644 --- a/lib/glyphs.js +++ b/lib/glyphs.js @@ -53,6 +53,10 @@ Glyphs.getNextUnverified = (glyph) => { return Glyphs.getNext(glyph, {'stages.verified': null}); } +Glyphs.getNextVerified = (glyph) => { + return Glyphs.getNext(glyph, {'stages.verified': {$ne: null}}); +} + Glyphs.getPrevious = (glyph, clause) => { clause = clause || {}; const codepoint = glyph ? glyph.codepoint : undefined; @@ -65,6 +69,10 @@ Glyphs.getPreviousUnverified = (glyph) => { return Glyphs.getPrevious(glyph, {'stages.verified': null}); } +Glyphs.getPreviousVerified = (glyph) => { + return Glyphs.getPrevious(glyph, {'stages.verified': {$ne: null}}); +} + Glyphs.save = (glyph) => { check(glyph.character, String); assert(glyph.character.length === 1); @@ -97,8 +105,9 @@ if (Meteor.isServer) { // Register the methods above so they are available to the client. const methods = {}; - const method_names = ['get', 'getNext', 'getNextUnverified', - 'getPrevious', 'getPreviousUnverified', 'save']; + const method_names = [ + 'get', 'getNext', 'getNextUnverified', 'getNextVerified', + 'getPrevious', 'getPreviousUnverified', 'getPreviousVerified', 'save']; method_names.map((name) => methods[`${name}Glyph`] = Glyphs[name]); methods.saveGlyphs = (glyphs) => glyphs.map(Glyphs.save); Meteor.methods(methods);