Skip to content

Commit d2ab272

Browse files
authored
Release/1.14.0 (#1392)
1 parent 72cbc1e commit d2ab272

24 files changed

+1816
-1775
lines changed

RELEASE-NOTES.txt

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
1.14.0
2+
------
3+
* Fix a bug on iOS 13.0 were tapping on a link opens Safari
4+
* Fix a link editing issue, where trying to add a empty link at the start of another link would remove the existing link.
5+
* Fix missing content on long posts in html mode on Android
6+
17
1.12.0
28
------
39
* Add rich text styling to video captions

__device-tests__/gutenberg-editor-block-insertion.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from './helpers/utils';
1616
import testData from './helpers/test-data';
1717

18-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
18+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;
1919

2020
describe( 'Gutenberg Editor tests for Block insertion', () => {
2121
let driver;

__device-tests__/gutenberg-editor-heading.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from './helpers/utils';
1515
import testData from './helpers/test-data';
1616

17-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
17+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;
1818

1919
describe( 'Gutenberg Editor tests', () => {
2020
let driver;

__device-tests__/gutenberg-editor-image.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from './helpers/utils';
1717
import testData from './helpers/test-data';
1818

19-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
19+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;
2020

2121
describe( 'Gutenberg Editor Image Block tests', () => {
2222
let driver;

__device-tests__/gutenberg-editor-lists-end.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from './helpers/utils';
1515
import testData from './helpers/test-data';
1616

17-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
17+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;
1818

1919
describe( 'Gutenberg Editor tests for List block (end)', () => {
2020
let driver;

__device-tests__/gutenberg-editor-lists.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import {
1414
} from './helpers/utils';
1515
import testData from './helpers/test-data';
1616

17-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
17+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;
1818

19-
xdescribe( 'Gutenberg Editor tests for List block', () => {
19+
describe( 'Gutenberg Editor tests for List block', () => {
2020
let driver;
2121
let editorPage;
2222
let allPassed = true;

__device-tests__/gutenberg-editor-paragraph.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from './helpers/utils';
1717
import testData from './helpers/test-data';
1818

19-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
19+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;
2020

2121
describe( 'Gutenberg Editor tests for Paragraph Block', () => {
2222
let driver;

__device-tests__/gutenberg-editor-paste.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
} from './helpers/utils';
1919
import testData from './helpers/test-data';
2020

21-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
21+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;
2222

2323
describe( 'Gutenberg Editor paste tests', () => {
2424
// skip iOS for now

__device-tests__/gutenberg-editor-rotatation.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import {
1515
} from './helpers/utils';
1616
import testData from './helpers/test-data';
1717

18-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;
18+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;
1919

20-
xdescribe( 'Gutenberg Editor tests', () => {
20+
describe( 'Gutenberg Editor tests', () => {
2121
let driver;
2222
let editorPage;
2323
let allPassed = true;

bundle/android/App.js

+864-863
Large diffs are not rendered by default.

bundle/android/App.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/ios/App.js

+872-871
Large diffs are not rendered by default.

bundle/ios/App.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gutenberg

Submodule gutenberg updated 828 files

jest_ui.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const main = require( './jest.config.js' );
55

66
module.exports = {
77
...main,
8+
timers: 'real',
89
setupFiles: [],
910
testMatch: [ '**/__device-tests__/**/*.test.[jt]s?(x)' ],
1011
testPathIgnorePatterns: [

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gutenberg-mobile",
3-
"version": "1.13.1",
3+
"version": "1.14.0",
44
"private": true,
55
"config": {
66
"jsfiles": "./*.js src/*.js src/**/*.js src/**/**/*.js",
@@ -147,8 +147,8 @@
147147
"node-libs-react-native": "^1.0.2",
148148
"node-sass": "^4.12.0",
149149
"react": "16.8.6",
150-
"react-native": "jtreanor/react-native#v0.60.0-patched",
151-
"react-native-dark-mode": "git+https://github.com/wordpress-mobile/react-native-dark-mode.git#f09bf1480e7b34536413ab3300f29e4375edb2c6",
150+
"react-native": "jtreanor/react-native#v0.60.0-patched",
151+
"react-native-dark-mode": "git+https://github.com/wordpress-mobile/react-native-dark-mode.git#f09bf1480e7b34536413ab3300f29e4375edb2c6",
152152
"react-native-hr": "git+https://github.com/Riglerr/react-native-hr.git#2d01a5cf77212d100e8b99e0310cce5234f977b3",
153153
"react-native-keyboard-aware-scroll-view": "git+https://github.com/wordpress-mobile/react-native-keyboard-aware-scroll-view.git#gb-v0.8.7",
154154
"react-native-modal": "^6.5.0",

react-native-aztec/android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ buildscript {
1212
wordpressUtilsVersion = '1.22'
1313
espressoVersion = '3.0.1'
1414

15-
aztecVersion = 'v1.3.30'
15+
aztecVersion = 'v1.3.31'
1616
}
1717

1818
repositories {

react-native-aztec/ios/Cartfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "wordpress-mobile/AztecEditor-iOS" "1.9.0"
1+
github "wordpress-mobile/AztecEditor-iOS" "1.10.1"
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "wordpress-mobile/AztecEditor-iOS" "1.9.0"
1+
github "wordpress-mobile/AztecEditor-iOS" "1.10.1"

react-native-aztec/ios/RNTAztecView/RCTAztecView.swift

+27-11
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,23 @@ class RCTAztecView: Aztec.TextView {
245245
}
246246

247247
override func paste(_ sender: Any?) {
248-
let start = selectedRange.location
249-
let end = selectedRange.location + selectedRange.length
250-
251248
let pasteboard = UIPasteboard.general
252249
let text = readText(from: pasteboard) ?? ""
253250
let html = readHTML(from: pasteboard) ?? ""
254251
let imagesURLs = readImages(from: pasteboard)
252+
sendPasteCallback(text: text, html: html, imagesURLs: imagesURLs);
253+
}
254+
255+
override func pasteWithoutFormatting(_ sender: Any?) {
256+
let pasteboard = UIPasteboard.general
257+
let text = readText(from: pasteboard) ?? ""
258+
let imagesURLs = readImages(from: pasteboard)
259+
sendPasteCallback(text: text, html: "", imagesURLs: imagesURLs);
260+
}
255261

262+
private func sendPasteCallback(text: String, html: String, imagesURLs: [String]) {
263+
let start = selectedRange.location
264+
let end = selectedRange.location + selectedRange.length
256265
onPaste?([
257266
"currentContent": cleanHTML(),
258267
"selectionStart": start,
@@ -570,8 +579,8 @@ class RCTAztecView: Aztec.TextView {
570579
// MARK: UITextView Delegate Methods
571580
extension RCTAztecView: UITextViewDelegate {
572581

573-
func textViewDidChangeSelection(_ textView: UITextView) {
574-
guard isInsertingDictationResult == false else {
582+
func textViewDidChangeSelection(_ textView: UITextView) {
583+
guard isFirstResponder, isInsertingDictationResult == false else {
575584
return
576585
}
577586

@@ -601,12 +610,19 @@ extension RCTAztecView: UITextViewDelegate {
601610
onBlur?([:])
602611
}
603612

604-
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
605-
// Sergio Estevao: This shouldn't happen in an editable textView, but it looks we have a system bug in iOS13 so we need this workaround
606-
let position = characterRange.location
607-
textView.selectedRange = NSRange(location: position, length: 0)
608-
textView.typingAttributes = textView.attributedText.attributes(at: position, effectiveRange: nil)
609-
textView.delegate?.textViewDidChangeSelection?(textView)
613+
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
614+
if #available(iOS 13.1, *) {
615+
return false
616+
} else if #available(iOS 13.0.0, *) {
617+
// Sergio Estevao: This shouldn't happen in an editable textView, but it looks we have a system bug in iOS13 so we need this workaround
618+
let position = characterRange.location
619+
textView.selectedRange = NSRange(location: position, length: 0)
620+
textView.typingAttributes = textView.attributedText.attributes(at: position, effectiveRange: nil)
621+
textView.delegate?.textViewDidChangeSelection?(textView)
622+
} else {
623+
return false
624+
}
625+
610626
return false
611627
}
612628
}

react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.app.Application;
55
import android.content.Context;
66
import android.content.MutableContextWrapper;
7+
import android.os.Build;
78
import android.os.Bundle;
89
import android.os.Handler;
910
import android.os.Looper;
@@ -521,7 +522,17 @@ public void appendMediaFile(int mediaId, final String mediaUrl, final boolean is
521522
}
522523
}
523524

524-
public void toggleEditorMode() {
525+
public void toggleEditorMode(boolean htmlModeEnabled) {
526+
// Turn off hardware acceleration for Oreo
527+
// see https://github.com/wordpress-mobile/gutenberg-mobile/issues/1268#issuecomment-535887390
528+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
529+
&& Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1) {
530+
if (htmlModeEnabled) {
531+
mReactRootView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
532+
} else {
533+
mReactRootView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
534+
}
535+
}
525536
mRnReactNativeGutenbergBridgePackage.getRNReactNativeGutenbergBridgeModule().toggleEditorMode();
526537
}
527538

src/index.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* External dependencies
99
*/
10-
import { AppRegistry, I18nManager, YellowBox } from 'react-native';
10+
import { AppRegistry, I18nManager } from 'react-native';
1111
import React from 'react';
1212

1313
/**
@@ -23,12 +23,8 @@ import { getTranslation } from '../i18n-cache';
2323
import initialHtml from './initial-html';
2424

2525
const gutenbergSetup = () => {
26-
const apiFetch = require( '@wordpress/api-fetch' ).default;
2726
const wpData = require( '@wordpress/data' );
2827

29-
// wp-api-fetch
30-
apiFetch.use( apiFetch.createRootURLMiddleware( 'https://public-api.wordpress.com/' ) );
31-
3228
// wp-data
3329
const userId = 1;
3430
const storageKey = 'WP_DATA_USER_' + userId;
@@ -82,8 +78,9 @@ export class RootComponent extends React.Component {
8278
}
8379

8480
export function registerApp() {
85-
// Disable require circle warnings showing up in the app (they will still be visible in the console)
86-
YellowBox.ignoreWarnings( [ 'Require cycle:' ] );
81+
// Disable warnings as they disrupt the user experience in dev mode
82+
// eslint-disable-next-line no-console
83+
console.disableYellowBox = true;
8784

8885
gutenbergSetup();
8986

src/index.test.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,25 @@ describe( 'RootComponent', () => {
2121
beforeAll( initializeEditor );
2222

2323
it( 'renders without crashing', () => {
24+
jest.useFakeTimers();
2425
const app = renderer.create( <RootComponent /> );
26+
// Gutenberg store currently has some asynchronous parts in the store setup
27+
// Need to run all ticks so `isReady` is true in the editor store
28+
// See: https://github.com/wordpress-mobile/gutenberg-mobile/pull/1366#discussion_r326813061
29+
renderer.act( () => {
30+
jest.runAllTicks();
31+
} );
2532
const rendered = app.toJSON();
2633
expect( rendered ).toBeTruthy();
2734
app.unmount();
2835
} );
2936

3037
it( 'renders without crashing with a block focused', () => {
3138
const app = renderer.create( <RootComponent /> );
32-
const blocks = select( 'core/block-editor' ).getBlocks();
33-
34-
// Methods that modify state are required to be called inside `act`
3539
renderer.act( () => {
40+
jest.runAllTicks();
41+
const blocks = select( 'core/block-editor' ).getBlocks();
42+
// Methods that modify state are required to be called inside `act`
3643
dispatch( 'core/block-editor' ).selectBlock( blocks[ 0 ].clientId );
3744
} );
3845

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../gutenberg/packages/block-directory/src

0 commit comments

Comments
 (0)