Skip to content

Commit

Permalink
Squashed 'libs/editor/' changes from 86805a0..571b0b7
Browse files Browse the repository at this point in the history
571b0b7 add license file
48a14b0 add assets link
9dcfa23 Add 'libs/editor-common/' from commit '9d488d2a1c610380aa9446f8c9fea50d15354a84'
9d488d2 initial commit
cdcc2a8 Initial commit
1b5d1fd add dependency on WordPressUtils and use AppLog instead of Log

git-subtree-dir: libs/editor
git-subtree-split: 571b0b7
  • Loading branch information
maxme committed Feb 5, 2015
1 parent 5df2a9b commit 77a78c9
Show file tree
Hide file tree
Showing 17 changed files with 4,235 additions and 21 deletions.
21 changes: 21 additions & 0 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2013 Automattic Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
## Introduction

The WordPress-Android-Editor is the text editor used in the [WordPress Android app](https://github.com/wordpress-mobile/WordPress-Android) to create and edit pages & posts. In short it's a simple, straightforward way to visually edit HTML.

## LICENSE

This library is licensed under[MIT](LICENSE-MIT)
1 change: 1 addition & 0 deletions editor/src/main/assets
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
package org.wordpress.android.editor;

import android.annotation.SuppressLint;
import android.content.res.AssetManager;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.webkit.ConsoleMessage;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class EditorActivity extends ActionBarActivity {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.content.res.AssetManager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -15,6 +14,9 @@
import android.webkit.WebView;
import android.webkit.WebViewClient;

import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.AppLog.T;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -63,32 +65,31 @@ public void onDetach() {
super.onDetach();
}

// TODO: use AppLog instead of Log
@SuppressLint("SetJavaScriptEnabled")
private void initWebView() {
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDefaultTextEncodingName("utf-8");
mWebView.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Log.e("WordPress-Editor", description);
AppLog.e(T.EDITOR, description);
}
});
mWebView.setWebChromeClient(new WebChromeClient() {
public boolean onConsoleMessage(ConsoleMessage cm) {
Log.e("WordPress-Editor", cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId());
AppLog.e(T.EDITOR, cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId());
return true;
}

@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
Log.e("WordPress-Editor", message);
AppLog.e(T.EDITOR, message);
return true;
}

@Override
public void onConsoleMessage(String message, int lineNumber, String sourceId) {
Log.e("WordPress-Editor", message + " -- from line " + lineNumber + " of " + sourceId);
AppLog.e(T.EDITOR, message + " -- from line " + lineNumber + " of " + sourceId);
}
});
String htmlEditor = getHtmlEditor();
Expand Down Expand Up @@ -117,7 +118,7 @@ private String getHtmlEditor() {
try {
return getStringFromAsset("android-editor.html");
} catch (IOException e) {
Log.e("WordPress-Editor", e.getMessage());
AppLog.e(T.EDITOR, e.getMessage());
return null;
}
}
Expand Down
4 changes: 4 additions & 0 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ buildscript {
}
}

repositories {
mavenCentral()
}

apply plugin: 'com.android.application'

android {
Expand Down
21 changes: 21 additions & 0 deletions libs/editor-common/LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2013 Automattic Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
5 changes: 5 additions & 0 deletions libs/editor-common/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# WordPress-Common-Editor
Common code of Android and iOS rich text editor component.

## LICENSE
This library is licensed under[MIT](LICENSE-MIT)
Loading

0 comments on commit 77a78c9

Please sign in to comment.