How to use the mobiledoc-kit/utils/browser.isMac function in mobiledoc-kit

To help you get started, we’ve selected a few mobiledoc-kit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TryGhost / Ghost-Admin / lib / koenig-editor / addon / components / koenig-card.js View on Github external
_handleKeydown(event) {
        if (
            this.isEditing
            && event.key === 'Escape'
            || (Browser.isMac() && event.key === 'Enter' && event.metaKey)
            || (!Browser.isMac() && event.key === 'Enter' && event.ctrlKey)
        ) {
            // run the select card routine with isEditing=false to exit edit mode
            this.selectCard(false);
            event.preventDefault();
        }
    },
github TryGhost / Ghost-Admin / lib / koenig-editor / addon / components / koenig-card.js View on Github external
_handleKeydown(event) {
        if (
            this.isEditing
            && event.key === 'Escape'
            || (Browser.isMac() && event.key === 'Enter' && event.metaKey)
            || (!Browser.isMac() && event.key === 'Enter' && event.ctrlKey)
        ) {
            // run the select card routine with isEditing=false to exit edit mode
            this.selectCard(false);
            event.preventDefault();
        }
    },
github bustle / mobiledoc-kit / src / js / editor / event-manager.js View on Github external
case key.isHorizontalArrowWithoutModifiersOtherThanShift(): {
        let newRange;
        if (key.isShift()) {
          newRange = range.extend(key.direction * 1);
        } else {
          newRange = range.move(key.direction);
        }

        editor.selectRange(newRange);
        event.preventDefault();
        break;
      }
      case key.isDelete(): {
        let { direction } = key;
        let unit = 'char';
        if (this.modifierKeys.alt && Browser.isMac()) {
          unit = 'word';
        } else if (this.modifierKeys.ctrl && Browser.isWin()) {
          unit = 'word';
        }
        editor.performDelete({direction, unit});
        event.preventDefault();
        break;
      }
      case key.isEnter():
        editor.handleNewline(event);
        break;
      case key.isTab():
        // Handle tab here because it does not fire a `keypress` event
        event.preventDefault();
        this._textInputHandler.handle(key.toString());
        break;
github TryGhost / Ghost-Admin / lib / koenig-editor / addon / options / key-commands.js View on Github external
run(editor, koenig) {
        if (Browser.isMac()) {
            return koenig.send('toggleMarkup', 'code');
        }

        return false;
    }
}];
github TryGhost / Ghost-Admin / lib / koenig-editor / addon / options / key-commands.js View on Github external
run(editor, koenig) {
        if (!Browser.isMac()) {
            return koenig.send('toggleMarkup', 'code');
        }

        return false;
    }
}, {