Skip to content

Commit

Permalink
Release/1.14.0 (#1392)
Browse files Browse the repository at this point in the history
  • Loading branch information
marecar3 committed Oct 4, 2019
1 parent 72cbc1e commit d2ab272
Show file tree
Hide file tree
Showing 24 changed files with 1,816 additions and 1,775 deletions.
6 changes: 6 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.14.0
------
* Fix a bug on iOS 13.0 were tapping on a link opens Safari
* Fix a link editing issue, where trying to add a empty link at the start of another link would remove the existing link.
* Fix missing content on long posts in html mode on Android

1.12.0
------
* Add rich text styling to video captions
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-block-insertion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

describe( 'Gutenberg Editor tests for Block insertion', () => {
let driver;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-heading.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

describe( 'Gutenberg Editor tests', () => {
let driver;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-image.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

describe( 'Gutenberg Editor Image Block tests', () => {
let driver;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-lists-end.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

describe( 'Gutenberg Editor tests for List block (end)', () => {
let driver;
Expand Down
4 changes: 2 additions & 2 deletions __device-tests__/gutenberg-editor-lists.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

xdescribe( 'Gutenberg Editor tests for List block', () => {
describe( 'Gutenberg Editor tests for List block', () => {
let driver;
let editorPage;
let allPassed = true;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-paragraph.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

describe( 'Gutenberg Editor tests for Paragraph Block', () => {
let driver;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-paste.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

describe( 'Gutenberg Editor paste tests', () => {
// skip iOS for now
Expand Down
4 changes: 2 additions & 2 deletions __device-tests__/gutenberg-editor-rotatation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

xdescribe( 'Gutenberg Editor tests', () => {
describe( 'Gutenberg Editor tests', () => {
let driver;
let editorPage;
let allPassed = true;
Expand Down
1,727 changes: 864 additions & 863 deletions bundle/android/App.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/android/App.js.map

Large diffs are not rendered by default.

1,743 changes: 872 additions & 871 deletions bundle/ios/App.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/ios/App.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 828 files
1 change: 1 addition & 0 deletions jest_ui.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const main = require( './jest.config.js' );

module.exports = {
...main,
timers: 'real',
setupFiles: [],
testMatch: [ '**/__device-tests__/**/*.test.[jt]s?(x)' ],
testPathIgnorePatterns: [
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gutenberg-mobile",
"version": "1.13.1",
"version": "1.14.0",
"private": true,
"config": {
"jsfiles": "./*.js src/*.js src/**/*.js src/**/**/*.js",
Expand Down Expand Up @@ -147,8 +147,8 @@
"node-libs-react-native": "^1.0.2",
"node-sass": "^4.12.0",
"react": "16.8.6",
"react-native": "jtreanor/react-native#v0.60.0-patched",
"react-native-dark-mode": "git+https://github.com/wordpress-mobile/react-native-dark-mode.git#f09bf1480e7b34536413ab3300f29e4375edb2c6",
"react-native": "jtreanor/react-native#v0.60.0-patched",
"react-native-dark-mode": "git+https://github.com/wordpress-mobile/react-native-dark-mode.git#f09bf1480e7b34536413ab3300f29e4375edb2c6",
"react-native-hr": "git+https://github.com/Riglerr/react-native-hr.git#2d01a5cf77212d100e8b99e0310cce5234f977b3",
"react-native-keyboard-aware-scroll-view": "git+https://github.com/wordpress-mobile/react-native-keyboard-aware-scroll-view.git#gb-v0.8.7",
"react-native-modal": "^6.5.0",
Expand Down
2 changes: 1 addition & 1 deletion react-native-aztec/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
wordpressUtilsVersion = '1.22'
espressoVersion = '3.0.1'

aztecVersion = 'v1.3.30'
aztecVersion = 'v1.3.31'
}

repositories {
Expand Down
2 changes: 1 addition & 1 deletion react-native-aztec/ios/Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "wordpress-mobile/AztecEditor-iOS" "1.9.0"
github "wordpress-mobile/AztecEditor-iOS" "1.10.1"
2 changes: 1 addition & 1 deletion react-native-aztec/ios/Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "wordpress-mobile/AztecEditor-iOS" "1.9.0"
github "wordpress-mobile/AztecEditor-iOS" "1.10.1"
38 changes: 27 additions & 11 deletions react-native-aztec/ios/RNTAztecView/RCTAztecView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,23 @@ class RCTAztecView: Aztec.TextView {
}

override func paste(_ sender: Any?) {
let start = selectedRange.location
let end = selectedRange.location + selectedRange.length

let pasteboard = UIPasteboard.general
let text = readText(from: pasteboard) ?? ""
let html = readHTML(from: pasteboard) ?? ""
let imagesURLs = readImages(from: pasteboard)
sendPasteCallback(text: text, html: html, imagesURLs: imagesURLs);
}

override func pasteWithoutFormatting(_ sender: Any?) {
let pasteboard = UIPasteboard.general
let text = readText(from: pasteboard) ?? ""
let imagesURLs = readImages(from: pasteboard)
sendPasteCallback(text: text, html: "", imagesURLs: imagesURLs);
}

private func sendPasteCallback(text: String, html: String, imagesURLs: [String]) {
let start = selectedRange.location
let end = selectedRange.location + selectedRange.length
onPaste?([
"currentContent": cleanHTML(),
"selectionStart": start,
Expand Down Expand Up @@ -570,8 +579,8 @@ class RCTAztecView: Aztec.TextView {
// MARK: UITextView Delegate Methods
extension RCTAztecView: UITextViewDelegate {

func textViewDidChangeSelection(_ textView: UITextView) {
guard isInsertingDictationResult == false else {
func textViewDidChangeSelection(_ textView: UITextView) {
guard isFirstResponder, isInsertingDictationResult == false else {
return
}

Expand Down Expand Up @@ -601,12 +610,19 @@ extension RCTAztecView: UITextViewDelegate {
onBlur?([:])
}

func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
// 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
let position = characterRange.location
textView.selectedRange = NSRange(location: position, length: 0)
textView.typingAttributes = textView.attributedText.attributes(at: position, effectiveRange: nil)
textView.delegate?.textViewDidChangeSelection?(textView)
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
if #available(iOS 13.1, *) {
return false
} else if #available(iOS 13.0.0, *) {
// 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
let position = characterRange.location
textView.selectedRange = NSRange(location: position, length: 0)
textView.typingAttributes = textView.attributedText.attributes(at: position, effectiveRange: nil)
textView.delegate?.textViewDidChangeSelection?(textView)
} else {
return false
}

return false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.app.Application;
import android.content.Context;
import android.content.MutableContextWrapper;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
Expand Down Expand Up @@ -521,7 +522,17 @@ public void appendMediaFile(int mediaId, final String mediaUrl, final boolean is
}
}

public void toggleEditorMode() {
public void toggleEditorMode(boolean htmlModeEnabled) {
// Turn off hardware acceleration for Oreo
// see https://github.com/wordpress-mobile/gutenberg-mobile/issues/1268#issuecomment-535887390
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1) {
if (htmlModeEnabled) {
mReactRootView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
} else {
mReactRootView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
}
mRnReactNativeGutenbergBridgePackage.getRNReactNativeGutenbergBridgeModule().toggleEditorMode();
}

Expand Down
11 changes: 4 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* External dependencies
*/
import { AppRegistry, I18nManager, YellowBox } from 'react-native';
import { AppRegistry, I18nManager } from 'react-native';
import React from 'react';

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

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

// wp-api-fetch
apiFetch.use( apiFetch.createRootURLMiddleware( 'https://public-api.wordpress.com/' ) );

// wp-data
const userId = 1;
const storageKey = 'WP_DATA_USER_' + userId;
Expand Down Expand Up @@ -82,8 +78,9 @@ export class RootComponent extends React.Component {
}

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

gutenbergSetup();

Expand Down
13 changes: 10 additions & 3 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,25 @@ describe( 'RootComponent', () => {
beforeAll( initializeEditor );

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

it( 'renders without crashing with a block focused', () => {
const app = renderer.create( <RootComponent /> );
const blocks = select( 'core/block-editor' ).getBlocks();

// Methods that modify state are required to be called inside `act`
renderer.act( () => {
jest.runAllTicks();
const blocks = select( 'core/block-editor' ).getBlocks();
// Methods that modify state are required to be called inside `act`
dispatch( 'core/block-editor' ).selectBlock( blocks[ 0 ].clientId );
} );

Expand Down
1 change: 1 addition & 0 deletions symlinked-packages/@wordpress/block-directory

0 comments on commit d2ab272

Please sign in to comment.