📄 editorwysiwyg.java
字号:
/*
* Copyright 2006 Pavel Jbanov.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.jpavel.gwt.wysiwyg.client;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FocusListener;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.queplix.core.client.common.StringUtil;
import com.queplix.core.client.common.event.EventSource;
import com.queplix.core.client.controls.QFormElementView;
public class EditorWYSIWYG extends Composite implements FocusListener {
private Editor editor;
private VerticalPanel vp;
private EditorIframe frame;
private TextArea textArea;
private boolean showFrame = true;
private boolean isFrameFocused;
public boolean isFrameFocused() {
return isFrameFocused;
}
// -------------------- public events ------------------------
private EventSource eventSource = new EventSource(this);
public EventSource getEventSource() {
return eventSource;
}
// ----------------- end of public events --------------------
public EditorWYSIWYG(Editor _editor) {
this.editor = _editor;
vp = new VerticalPanel();
vp.setWidth("100%");
frame = new EditorIframe();
frame.setWidth("100%");
frame.addFocusListener(this);
// this is done on purpose...
if (EditorUtils.isGecko()) {
frame.addMouseOverListener(new EditorMouseOverListener() {
public void onMouseOver(Widget widget) {
enableDesignMode();
frame.removeMouseOverListener(this);
}
});
}
textArea = new TextArea();
textArea.addStyleName("styled_input");
textArea.setWidth("100%");
textArea.addFocusListener(this);
frame.setVisible(true);
textArea.setVisible(false);
vp.add(frame);
vp.add(textArea);
initWidget(vp);
}
//<body CONTENTEDITABLE=\"true\" onload=抎ocument.designMode = \"On\";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -