Skip to content

Commit

Permalink
Squashed 'libs/editor/' changes from 31b66df..fa030e4
Browse files Browse the repository at this point in the history
fa030e4 Merge pull request #386 from wordpress-mobile/issue/382-visual-more-tag
53cd44c Fix visual delete of the more/nextpage tags
2d8a0ee Add support for <--nextpage--> tag
6b9ed32 use Calypso _more_ graphic
a833c81 fix #382: show a dashed horizontal line in place of the more tag
fb8864a Merge pull request #384 from wordpress-mobile/issue/373-tap-image-scroll
b1d076d When giving focus to a selected image, set the cursor after the image element
4200032 When an image is tapped and the edit overlay is about to be displayed, give focus to the image
8e571a6 Merge pull request #381 from wordpress-mobile/issue/380-isAdded-checks
0fb2a51 Merge pull request #379 from wordpress-mobile/issue/368-multiple-tap-on-links
fe42eea Merge pull request #378 from wordpress-mobile/issue/376-image-settings-quotes
97b2ad0 Add isAdded() checks where getActivity is called
f45779b fix #368: remove a workaround that introduced the issue
5b1a0c7 fix #376: escape quotes in imageMeta var
08e4067 Merge pull request #375 from wordpress-mobile/issue/370-dashicons-to-gridicons
707e3ab Center the format bar icons vertically on 600dp+ screens
af2165d Fixed vertical stretch of format bar icons on 600dp+ screens
c9da68b Changed format bar icon color to #87A6BC grey
2372219 In the 380dp format bar, wrapped each icon in a LinearLayout to fix horizontal stretch issue
e80ed09 Upgrade to support libraries v23.4.0
fd9a388 Updated gridicons with built-in padding
3a57253 Merge pull request #372 from wordpress-mobile/issue/301-media-tap-to-remove
b250069 When the image settings dialog is dismissed, clear the currentEditingImage in the ZSSEditor
69f5574 Clear currentEditingImage when launching the image settings dialog
0ef392d Updated format bar VectorDrawables to ones with built-in padding
81cad67 Fixed missing 10% dark background for large retry buttons
e82d850 Duplicated changes to image retry button for videos
8de3ede Updated image upload retry button for large images to use a gridicon
26c701f Adjusted 'Tap to try again!' text weight to Medium
a296969 Adjusted spacing between retry icon and text
8f90299 Update retry icon from dashicon to gridicon
f296272 When selecting an image, add the image node to the MutationObserver to track manual deletion
3592f3b Adjusted font-weight for 'Edit' text to match Roboto Medium
ee0117f Use the new (gridicon) edit icon for small images too
64f0d47 Moved edit-icon css under edit-overlay
bde3d08 Replaced more button PNGs with VectorDrawables
e0dfa8a Use VectorDrawables instead of PNGs for format bar
cb9d3b0 Updated edit image icon (normal size)
0506e72 Updated delete image button
7b6c732 Fixed alignment mistake in delete image button
cc33016 Moved wpposter.svg to /svg/ folder
3e27b48 Replaced inline svgs in the CSS with files in the /svg/ directory
6408695 Rely on node.parent.removeChild(node) rather than node.remove() since the latter is unsupported on API<19
e4e159d When deleting an image, run emptyFieldIfNoContents to clear any empty divs remaining, so the placeholder will re-appear
6ddb355 Clear currentEditingImage when an image is deleted
101551e Don't add delete overlay for very small images
e9a318b Adjusted media delete button handling to avoid deleting anything beyond the media's containing paragraph
74a9273 Remove image from document when delete button is tapped
785d0b5 Color image delete button red
e2b5fcd Added delete button to top right of images when they're selected (and the edit overlay is visible)
d3e97b0 Fixed issue where image settings screen wouldn't load in the example app

git-subtree-dir: libs/editor
git-subtree-split: fa030e4a8f03313a4311a18e950a0cb539c5dcdc
  • Loading branch information
maxme committed May 29, 2016
1 parent 3b37573 commit 5da21ed
Show file tree
Hide file tree
Showing 162 changed files with 933 additions and 378 deletions.
6 changes: 3 additions & 3 deletions WordPressEditor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ android {
}

dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'org.wordpress:utils:1.9.0'

// Test libraries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@ protected void initJsEditor() {
}

public void checkForFailedUploadAndSwitchToHtmlMode(final ToggleButton toggleButton) {
if (!isAdded()) {
return;
}

// Show an Alert Dialog asking the user if he wants to remove all failed media before upload
if (hasFailedMediaUploads()) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
Expand All @@ -432,15 +436,17 @@ public void onClick(DialogInterface dialog, int which) {
}

private void toggleHtmlMode(final ToggleButton toggleButton) {
if (!isAdded()) {
return;
}

mEditorFragmentListener.onTrackableEvent(TrackableEvent.HTML_BUTTON_TAPPED);

// Don't switch to HTML mode if currently uploading media
if (!mUploadingMedia.isEmpty()) {
toggleButton.setChecked(false);

if (isAdded()) {
ToastUtils.showToast(getActivity(), R.string.alert_html_toggle_uploading, ToastUtils.Duration.LONG);
}
ToastUtils.showToast(getActivity(), R.string.alert_html_toggle_uploading, ToastUtils.Duration.LONG);
return;
}

Expand All @@ -451,6 +457,10 @@ private void toggleHtmlMode(final ToggleButton toggleButton) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
if (!isAdded()) {
return;
}

// Update mTitle and mContentHtml with the latest state from the ZSSEditor
getTitle();
getContent();
Expand Down Expand Up @@ -525,6 +535,10 @@ private void displayLinkDialog() {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
if (!isAdded()) {
return;
}

mGetSelectedTextCountDownLatch = new CountDownLatch(1);
getActivity().runOnUiThread(new Runnable() {
@Override
Expand Down Expand Up @@ -553,6 +567,10 @@ public void run() {

@Override
public void onClick(View v) {
if (!isAdded()) {
return;
}

int id = v.getId();
if (id == R.id.format_bar_button_html) {
checkForFailedUploadAndSwitchToHtmlMode((ToggleButton) v);
Expand All @@ -564,9 +582,7 @@ public void onClick(View v) {
ToastUtils.showToast(getActivity(), R.string.alert_insert_image_html_mode, ToastUtils.Duration.LONG);
} else {
mEditorFragmentListener.onAddMediaClicked();
if (isAdded()) {
getActivity().openContextMenu(mTagToggleButtonMap.get(TAG_FORMAT_BAR_BUTTON_MEDIA));
}
getActivity().openContextMenu(mTagToggleButtonMap.get(TAG_FORMAT_BAR_BUTTON_MEDIA));
}
} else if (id == R.id.format_bar_button_link) {
if (!((ToggleButton) v).isChecked()) {
Expand Down Expand Up @@ -668,6 +684,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
}
} else if (requestCode == ImageSettingsDialogFragment.IMAGE_SETTINGS_DIALOG_REQUEST_CODE) {
if (data == null) {
mWebView.execJavaScriptFromString("ZSSEditor.clearCurrentEditingImage();");
return;
}

Expand All @@ -676,7 +693,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
return;
}

final String imageMeta = extras.getString("imageMeta");
final String imageMeta = Utils.escapeQuotes(StringUtils.notNullStr(extras.getString("imageMeta")));
final int imageRemoteId = extras.getInt("imageRemoteId");
final boolean isFeaturedImage = extras.getBoolean("isFeatured");

Expand Down Expand Up @@ -1106,7 +1123,7 @@ public void run() {
}

public void onMediaTapped(final String mediaId, final MediaType mediaType, final JSONObject meta, String uploadStatus) {
if (mediaType == null) {
if (mediaType == null || !isAdded()) {
return;
}

Expand Down Expand Up @@ -1190,7 +1207,11 @@ public void run() {
// Request and add an authorization header for HTTPS images
// Use https:// when requesting the auth header, in case the image is incorrectly using http://.
// If an auth header is returned, force https:// for the actual HTTP request.
HashMap<String, String> headerMap = new HashMap<>(mCustomHttpHeaders);
HashMap<String, String> headerMap = new HashMap<>();
if (mCustomHttpHeaders != null) {
headerMap.putAll(mCustomHttpHeaders);
}

try {
final String imageSrc = meta.getString("src");
String authHeader = mEditorFragmentListener.onAuthHeaderRequested(UrlUtils.makeHttps(imageSrc));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ public void dismissFragment() {
AppLog.d(AppLog.T.EDITOR, "Unable to update JSON array");
}

getTargetFragment().onActivityResult(getTargetRequestCode(), getTargetRequestCode(), null);
restorePreviousActionBar();
getFragmentManager().popBackStack();
}
Expand All @@ -281,6 +282,7 @@ private void showDiscardChangesDialog() {
builder.setTitle(getString(R.string.image_settings_dismiss_dialog_title));
builder.setPositiveButton(getString(R.string.discard), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
getTargetFragment().onActivityResult(getTargetRequestCode(), getTargetRequestCode(), null);
restorePreviousActionBar();
getFragmentManager().popBackStack();
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
18 changes: 18 additions & 0 deletions WordPressEditor/src/main/res/drawable/format_bar_button_bold.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">

<path
android:fillColor="#87A6BC"
android:pathData="M17,15.009h4.547c2.126,0,3.671,0.303,4.632,0.907c0.962,0.605,1.442,1.567,1.442,2.887
c0,0.896-0.211,1.63-0.631,2.205c-0.421,0.574-0.98,0.919-1.678,1.036v0.103c0.951,0.212,1.637,0.608,2.057,1.189
C27.79,23.916,28,24.688,28,25.652c0,1.367-0.494,2.434-1.482,3.199C25.529,29.617,24.186,30,22.491,30H17V15.009z
M20,20.946
h2.027c0.862,0,1.486-0.133,1.872-0.4c0.387-0.267,0.579-0.708,0.579-1.323c0-0.574-0.21-0.986-0.63-1.236
c-0.421-0.249-1.087-0.374-1.996-0.374H20V20.946z
M20,23.469v3.906h2.253c0.876,0,1.521-0.167,1.939-0.502
s0.626-0.848,0.626-1.539c0-1.244-0.889-1.865-2.668-1.865H20z" />
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">

<path
android:fillColor="#E8EEF2"
android:pathData="M17,15.009h4.547c2.126,0,3.671,0.303,4.632,0.907c0.962,0.605,1.442,1.567,1.442,2.887
c0,0.896-0.211,1.63-0.631,2.205c-0.421,0.574-0.98,0.919-1.678,1.036v0.103c0.951,0.212,1.637,0.608,2.057,1.189
C27.79,23.916,28,24.688,28,25.652c0,1.367-0.494,2.434-1.482,3.199C25.529,29.617,24.186,30,22.491,30H17V15.009z
M20,20.946
h2.027c0.862,0,1.486-0.133,1.872-0.4c0.387-0.267,0.579-0.708,0.579-1.323c0-0.574-0.21-0.986-0.63-1.236
c-0.421-0.249-1.087-0.374-1.996-0.374H20V20.946z
M20,23.469v3.906h2.253c0.876,0,1.521-0.167,1.939-0.502
s0.626-0.848,0.626-1.539c0-1.244-0.889-1.865-2.668-1.865H20z" />
</vector>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">

<path
android:fillColor="#0084BC"
android:pathData="M17,15.009h4.547c2.126,0,3.671,0.303,4.632,0.907c0.962,0.605,1.442,1.567,1.442,2.887
c0,0.896-0.211,1.63-0.631,2.205c-0.421,0.574-0.98,0.919-1.678,1.036v0.103c0.951,0.212,1.637,0.608,2.057,1.189
C27.79,23.916,28,24.688,28,25.652c0,1.367-0.494,2.434-1.482,3.199C25.529,29.617,24.186,30,22.491,30H17V15.009z
M20,20.946
h2.027c0.862,0,1.486-0.133,1.872-0.4c0.387-0.267,0.579-0.708,0.579-1.323c0-0.574-0.21-0.986-0.63-1.236
c-0.421-0.249-1.087-0.374-1.996-0.374H20V20.946z
M20,23.469v3.906h2.253c0.876,0,1.521-0.167,1.939-0.502
s0.626-0.848,0.626-1.539c0-1.244-0.889-1.865-2.668-1.865H20z" />
</vector>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@drawable/format_bar_button_bold_selected_state"/>
<item android:state_pressed="true" android:drawable="@drawable/format_bar_button_bold_selected_state"/>
<item android:state_enabled="false" android:drawable="@drawable/format_bar_button_bold_disabled_state"/>
<item>
<bitmap
android:src="@drawable/format_bar_button_bold"
android:gravity="center"/>
</item>
<item android:state_checked="true" android:drawable="@drawable/format_bar_button_bold_highlighted"/>
<item android:state_pressed="true" android:drawable="@drawable/format_bar_button_bold_highlighted"/>
<item android:state_enabled="false" android:drawable="@drawable/format_bar_button_bold_disabled"/>
<item android:drawable="@drawable/format_bar_button_bold"/>
</selector>
21 changes: 21 additions & 0 deletions WordPressEditor/src/main/res/drawable/format_bar_button_html.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">

<path
android:fillColor="#87A6BC"
android:pathData="M16.294,25h-1.288v-2.738h-1.907V25h-1.292v-6.398h1.292v2.588h1.907v-2.588h1.288V25z" />
<path
android:fillColor="#87A6BC"
android:pathData="M21.348,19.678h-1.582V25h-1.297v-5.322h-1.555v-1.077h4.434V19.678z" />
<path
android:fillColor="#87A6BC"
android:pathData="M23.777,18.602l1.209,4.627l1.204-4.627h1.688V25h-1.296v-1.731l0.118-2.667L25.422,25h-0.879
l-1.279-4.399l0.119,2.667V25H22.09v-6.398H23.777z" />
<path
android:fillColor="#87A6BC"
android:pathData="M30.207,23.928h2.268V25h-3.561v-6.398h1.293V23.928z" />
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">

<path
android:fillColor="#E8EEF2"
android:pathData="M15.006,21.19h-1.907v-2.588h-1.292V25h1.292v-2.738h1.907V25h1.288v-6.398h-1.288V21.19z
M16.914,19.678h1.555V25h1.297v-5.322h1.582v-1.077h-4.434V19.678z
M24.986,23.229l-1.209-4.627H22.09V25h1.293v-1.731
l-0.119-2.667L24.543,25h0.879l1.278-4.399l-0.118,2.667V25h1.296v-6.398H26.19L24.986,23.229z
M30.207,23.928v-5.326h-1.293V25 h3.561v-1.072H30.207z" />
</vector>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">

<path
android:fillColor="#0084BC"
android:pathData="M15.006,21.19h-1.907v-2.588h-1.292V25h1.292v-2.738h1.907V25h1.288v-6.398h-1.288V21.19z
M16.914,19.678h1.555V25h1.297v-5.322h1.582v-1.077h-4.434V19.678z
M24.986,23.229l-1.209-4.627H22.09V25h1.293v-1.731
l-0.119-2.667L24.543,25h0.879l1.278-4.399l-0.118,2.667V25h1.296v-6.398H26.19L24.986,23.229z
M30.207,23.928v-5.326h-1.293V25 h3.561v-1.072H30.207z" />
</vector>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@drawable/format_bar_button_html_selected_state"/>
<item android:state_pressed="true" android:drawable="@drawable/format_bar_button_html_selected_state"/>
<item android:state_enabled="false" android:drawable="@drawable/format_bar_button_html_disabled_state"/>
<item>
<bitmap
android:src="@drawable/format_bar_button_html"
android:gravity="center"/>
</item>
<item android:state_checked="true" android:drawable="@drawable/format_bar_button_html_highlighted"/>
<item android:state_pressed="true" android:drawable="@drawable/format_bar_button_html_highlighted"/>
<item android:state_enabled="false" android:drawable="@drawable/format_bar_button_html_disabled"/>
<item android:drawable="@drawable/format_bar_button_html"/>
</selector>
11 changes: 11 additions & 0 deletions WordPressEditor/src/main/res/drawable/format_bar_button_italic.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">

<path
android:fillColor="#87A6BC"
android:pathData="M 20.536 15 L 20.109 17 L 21.609 17 L 19.263 28 L 17.763 28 L 17.336 30 L 23.464 30 L 23.89 28 L 22.39 28 L 24.737 17 L 26.237 17 L 26.664 15 Z" />
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">

<path
android:fillColor="#E8EEF2"
android:pathData="M 20.536 15 L 20.109 17 L 21.609 17 L 19.263 28 L 17.763 28 L 17.336 30 L 23.464 30 L 23.89 28 L 22.39 28 L 24.737 17 L 26.237 17 L 26.664 15 Z" />
</vector>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">

<path
android:fillColor="#0084BC"
android:pathData="M 20.536 15 L 20.109 17 L 21.609 17 L 19.263 28 L 17.763 28 L 17.336 30 L 23.464 30 L 23.89 28 L 22.39 28 L 24.737 17 L 26.237 17 L 26.664 15 Z" />
</vector>

This file was deleted.

Loading

0 comments on commit 5da21ed

Please sign in to comment.