forked from wordpress-mobile/gutenberg-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement bold, italic, and add/edit link shortcuts
Fixes wordpress-mobile#861
- Loading branch information
Showing
13 changed files
with
196 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[submodule "gutenberg"] | ||
path = gutenberg | ||
url = ../../WordPress/gutenberg.git | ||
url = https://github.com/kmdupr33/gutenberg | ||
[submodule "react-native-aztec"] | ||
path = react-native-aztec-old-submodule | ||
url = ../react-native-aztec.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule gutenberg
updated
from 73994a to c381df
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import UIKit | ||
import RNReactNativeGutenbergBridge | ||
|
||
class ShortcutCoordinator: UIResponder { | ||
let gutenberg: Gutenberg | ||
var responder: UIResponder? | ||
init(gutenberg: Gutenberg) { | ||
self.gutenberg = gutenberg | ||
} | ||
|
||
@objc func toggleBold() { | ||
gutenberg.sendShortcut(.bold) | ||
} | ||
|
||
@objc func toggleItalic() { | ||
gutenberg.sendShortcut(.italic) | ||
} | ||
|
||
@objc func addEditLink() { | ||
gutenberg.sendShortcut(.addEditLink) | ||
} | ||
|
||
override var next: UIResponder? { | ||
return responder | ||
} | ||
|
||
override var keyCommands: [UIKeyCommand]? { | ||
return [ | ||
UIKeyCommand(input:"B", | ||
modifierFlags: .command, | ||
action:#selector(toggleBold), | ||
discoverabilityTitle:NSLocalizedString("Bold", comment: "Discoverability title for bold formatting keyboard shortcut.") | ||
), | ||
UIKeyCommand(input:"I", | ||
modifierFlags: .command, | ||
action:#selector(toggleItalic), | ||
discoverabilityTitle:NSLocalizedString("Italic", comment: "Discoverability title for italic formatting keyboard shortcut.") | ||
), | ||
UIKeyCommand(input: "K", | ||
modifierFlags: .command, | ||
action:#selector(addEditLink), | ||
discoverabilityTitle:NSLocalizedString("Add/Edit Link", comment: "Discoverability title for add/edit link keyboard shortcut") | ||
) | ||
] | ||
} | ||
} | ||
|
7 changes: 2 additions & 5 deletions
7
...c/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/GutenbergBridgeJS2Parent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.