Compare commits

...

39 Commits

Author SHA1 Message Date
gqc cf1ca953e1 完结
3 months ago
gqc d240884734 完结
3 months ago
gqc 80594f3a1d 完结
3 months ago
gqc 11a7a862fe 最终
3 months ago
gqc fbe1bc455c 完结
3 months ago
gqc 7e278636e6 完结
3 months ago
p8flu92e4 fa26ed7be5 Update views.py
4 months ago
p8flu92e4 f5555c5ddf Update forms.py
4 months ago
p8flu92e4 bc61e94fe0 Update apps.py
4 months ago
p8flu92e4 52be3ba528 Update admin.py
4 months ago
p8flu92e4 7975bbd78f Update admin.py
4 months ago
gqc 95598efd21 update
4 months ago
pywbjfl98 3cac588304 Update views.py
4 months ago
pywbjfl98 6a3ad7af32 Update loader.py
4 months ago
gqc 6a1b91b221 v1.0
4 months ago
gqc 1d5d0a3a0d v1.0
4 months ago
gqc c4b044df61 v1.0
4 months ago
gqc 521ca8bdbc v1.0
4 months ago
p8flu92e4 17b15fcd2f Merge pull request '改进没问题了' (#14) from gqc_branch into master
4 months ago
gqc 070bea34c9 v1.0
4 months ago
pu685px73 da4b2ff1ca ADD file via upload
4 months ago
pu685px73 3bda9d21a1 ADD file via upload
4 months ago
pu685px73 0af5d7a8b2 Delete 'doc/第六周大作业(个人想法).docx'
4 months ago
pu685px73 3d239215da Delete 'doc/第五周大作业(个人想法).docx'
4 months ago
pu685px73 724933fe75 Delete 'README.md'
4 months ago
p8flu92e4 11e70cc5a0 Merge pull request '第六周大作业(个人想法)' (#13) from gqc_branch into master
4 months ago
gqc 8d77378fed v1.0
4 months ago
pu685px73 ba62a80850 Delete 'doc/云笔记个人博客系统设计文档.docx'
4 months ago
gqc 2a6569fdef v1.0
4 months ago
gqc 2dfd6f1cfa v1.0
4 months ago
gqc d3deb06b21 v1.0
4 months ago
pywbjfl98 35eccba68d Merge pull request '1111212121' (#12) from lxy_branch into master
5 months ago
pup2vei6r 765d6aeaac Merge pull request '6' (#11) from yyb_branch into master
5 months ago
pup2vei6r 102ed61014 Update README.md
5 months ago
pywbjfl98 913b0a8e07 TTest
5 months ago
pup2vei6r 1ed36f7564 Merge pull request '1' (#1) from lxy_branch into master
5 months ago
刘夏渝 e544cc5289 TTTTest
5 months ago
刘夏渝 4aaff977e2 更新文档
5 months ago
刘夏渝 0cccd9607e 更新README和main.py文件
5 months ago

@ -1,2 +0,0 @@
# homework

Binary file not shown.

@ -1,2 +0,0 @@
基于Python的Hello World

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.

@ -1 +1,32 @@
print("Hello World")
def is_prime(n):
"""判断一个数是否为质数"""
if n <= 1:
return False
if n == 2:
return True
if n % 2 == 0:
return False
for i in range(3, int(n**0.5) + 1, 2):
if n % i == 0:
return False
return True
def print_first_n_primes(n):
"""打印前n个质数"""
count = 0
num = 2
primes = []
while count < n:
if is_prime(num):
primes.append(num)
count += 1
num += 1
# 打印结果每10个一行
for i in range(0, len(primes), 10):
print(", ".join(map(str, primes[i:i+10])))
# 输出前100位质数
print("前100位质数为:")
print_first_n_primes(100)

@ -0,0 +1,5 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.7 (Blog)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="R User Library" level="project" />
<orderEntry type="library" name="R Skeletons" level="application" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module>

@ -0,0 +1,436 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DBNavigator.Project.DDLFileAttachmentManager">
<mappings />
<preferences />
</component>
<component name="DBNavigator.Project.DatabaseAssistantManager">
<assistants />
</component>
<component name="DBNavigator.Project.DatabaseFileManager">
<open-files />
</component>
<component name="DBNavigator.Project.Settings">
<connections />
<browser-settings>
<general>
<display-mode value="TABBED" />
<navigation-history-size value="100" />
<show-object-details value="false" />
<enable-sticky-paths value="true" />
<enable-quick-filters value="false" />
</general>
<filters>
<object-type-filter>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="true" />
<object-type name="ROLE" enabled="true" />
<object-type name="PRIVILEGE" enabled="true" />
<object-type name="CHARSET" enabled="true" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="JSON_VIEW" enabled="true" />
<object-type name="MATERIALIZED_VIEW" enabled="true" />
<object-type name="NESTED_TABLE" enabled="true" />
<object-type name="COLUMN" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET_TRIGGER" enabled="true" />
<object-type name="DATABASE_TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="true" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="TYPE_ATTRIBUTE" enabled="true" />
<object-type name="ARGUMENT" enabled="true" />
<object-type name="JAVA_CLASS" enabled="true" />
<object-type name="JAVA_FIELD" enabled="true" />
<object-type name="JAVA_METHOD" enabled="true" />
<object-type name="JAVA_RESOURCE" enabled="true" />
<object-type name="DIMENSION" enabled="true" />
<object-type name="CLUSTER" enabled="true" />
<object-type name="DBLINK" enabled="true" />
<object-type name="CREDENTIAL" enabled="true" />
<object-type name="AI_PROFILE" enabled="true" />
</object-type-filter>
</filters>
<sorting>
<object-type name="COLUMN" sorting-type="NAME" />
<object-type name="FUNCTION" sorting-type="NAME" />
<object-type name="PROCEDURE" sorting-type="NAME" />
<object-type name="ARGUMENT" sorting-type="POSITION" />
<object-type name="TYPE ATTRIBUTE" sorting-type="POSITION" />
</sorting>
<default-editors>
<object-type name="VIEW" editor-type="SELECTION" />
<object-type name="PACKAGE" editor-type="SELECTION" />
<object-type name="TYPE" editor-type="SELECTION" />
</default-editors>
</browser-settings>
<navigation-settings>
<lookup-filters>
<lookup-objects>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="false" />
<object-type name="ROLE" enabled="false" />
<object-type name="PRIVILEGE" enabled="false" />
<object-type name="CHARSET" enabled="false" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="JSON VIEW" enabled="true" />
<object-type name="MATERIALIZED VIEW" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET TRIGGER" enabled="true" />
<object-type name="DATABASE TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="false" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="JAVA CLASS" enabled="true" />
<object-type name="INNER CLASS" enabled="true" />
<object-type name="JAVA FIELD" enabled="true" />
<object-type name="JAVA METHOD" enabled="true" />
<object-type name="JAVA PARAMETER" enabled="true" />
<object-type name="JAVA RESOURCE" enabled="true" />
<object-type name="DIMENSION" enabled="false" />
<object-type name="CLUSTER" enabled="false" />
<object-type name="DBLINK" enabled="false" />
<object-type name="CREDENTIAL" enabled="false" />
</lookup-objects>
<force-database-load value="false" />
<prompt-connection-selection value="true" />
<prompt-schema-selection value="true" />
</lookup-filters>
</navigation-settings>
<dataset-grid-settings>
<general>
<enable-zooming value="true" />
<enable-column-tooltip value="true" />
</general>
<sorting>
<nulls-first value="true" />
<max-sorting-columns value="4" />
</sorting>
<audit-columns>
<column-names value="" />
<visible value="true" />
<editable value="false" />
</audit-columns>
</dataset-grid-settings>
<dataset-editor-settings>
<text-editor-popup>
<active value="false" />
<active-if-empty value="false" />
<data-length-threshold value="100" />
<popup-delay value="1000" />
</text-editor-popup>
<values-actions-popup>
<show-popup-button value="true" />
<element-count-threshold value="1000" />
<data-length-threshold value="250" />
</values-actions-popup>
<general>
<fetch-block-size value="100" />
<fetch-timeout value="30" />
<trim-whitespaces value="true" />
<convert-empty-strings-to-null value="true" />
<select-content-on-cell-edit value="true" />
<large-value-preview-active value="true" />
</general>
<filters>
<prompt-filter-dialog value="true" />
<default-filter-type value="BASIC" />
</filters>
<qualified-text-editor text-length-threshold="300">
<content-types>
<content-type name="Text" enabled="true" />
<content-type name="Properties" enabled="true" />
<content-type name="XML" enabled="true" />
<content-type name="DTD" enabled="true" />
<content-type name="HTML" enabled="true" />
<content-type name="XHTML" enabled="true" />
<content-type name="SQL" enabled="true" />
<content-type name="PL/SQL" enabled="true" />
<content-type name="JSON" enabled="true" />
<content-type name="JSON5" enabled="true" />
<content-type name="YAML" enabled="true" />
</content-types>
</qualified-text-editor>
<record-navigation>
<navigation-target value="VIEWER" />
</record-navigation>
</dataset-editor-settings>
<code-editor-settings>
<general>
<show-object-navigation-gutter value="false" />
<show-spec-declaration-navigation-gutter value="true" />
<enable-spellchecking value="true" />
<enable-reference-spellchecking value="false" />
</general>
<confirmations>
<save-changes value="false" />
<revert-changes value="true" />
<exit-on-changes value="ASK" />
</confirmations>
</code-editor-settings>
<code-completion-settings>
<filters>
<basic-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="json view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="false" />
<filter-element type="OBJECT" id="view" selected="false" />
<filter-element type="OBJECT" id="json view" selected="false" />
<filter-element type="OBJECT" id="materialized view" selected="false" />
<filter-element type="OBJECT" id="index" selected="false" />
<filter-element type="OBJECT" id="constraint" selected="false" />
<filter-element type="OBJECT" id="trigger" selected="false" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="false" />
<filter-element type="OBJECT" id="procedure" selected="false" />
<filter-element type="OBJECT" id="function" selected="false" />
<filter-element type="OBJECT" id="package" selected="false" />
<filter-element type="OBJECT" id="type" selected="false" />
<filter-element type="OBJECT" id="dimension" selected="false" />
<filter-element type="OBJECT" id="cluster" selected="false" />
<filter-element type="OBJECT" id="dblink" selected="false" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="json view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</basic-filter>
<extended-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="json view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="json view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="json view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</extended-filter>
</filters>
<sorting enabled="true">
<sorting-element type="RESERVED_WORD" id="keyword" />
<sorting-element type="RESERVED_WORD" id="datatype" />
<sorting-element type="OBJECT" id="column" />
<sorting-element type="OBJECT" id="table" />
<sorting-element type="OBJECT" id="view" />
<sorting-element type="OBJECT" id="json view" />
<sorting-element type="OBJECT" id="materialized view" />
<sorting-element type="OBJECT" id="index" />
<sorting-element type="OBJECT" id="constraint" />
<sorting-element type="OBJECT" id="trigger" />
<sorting-element type="OBJECT" id="synonym" />
<sorting-element type="OBJECT" id="sequence" />
<sorting-element type="OBJECT" id="procedure" />
<sorting-element type="OBJECT" id="function" />
<sorting-element type="OBJECT" id="package" />
<sorting-element type="OBJECT" id="type" />
<sorting-element type="OBJECT" id="dimension" />
<sorting-element type="OBJECT" id="cluster" />
<sorting-element type="OBJECT" id="dblink" />
<sorting-element type="OBJECT" id="schema" />
<sorting-element type="OBJECT" id="role" />
<sorting-element type="OBJECT" id="user" />
<sorting-element type="RESERVED_WORD" id="function" />
<sorting-element type="RESERVED_WORD" id="parameter" />
</sorting>
<format>
<enforce-code-style-case value="true" />
</format>
</code-completion-settings>
<execution-engine-settings>
<statement-execution>
<fetch-block-size value="100" />
<execution-timeout value="20" />
<debug-execution-timeout value="600" />
<focus-result value="false" />
<prompt-execution value="false" />
</statement-execution>
<script-execution>
<command-line-interfaces />
<execution-timeout value="300" />
</script-execution>
<method-execution>
<execution-timeout value="30" />
<debug-execution-timeout value="600" />
<parameter-history-size value="10" />
</method-execution>
</execution-engine-settings>
<operation-settings>
<transactions>
<uncommitted-changes>
<on-project-close value="ASK" />
<on-disconnect value="ASK" />
<on-autocommit-toggle value="ASK" />
</uncommitted-changes>
<multiple-uncommitted-changes>
<on-commit value="ASK" />
<on-rollback value="ASK" />
</multiple-uncommitted-changes>
</transactions>
<session-browser>
<disconnect-session value="ASK" />
<kill-session value="ASK" />
<reload-on-filter-change value="false" />
</session-browser>
<compiler>
<compile-type value="KEEP" />
<compile-dependencies value="ASK" />
<always-show-controls value="false" />
</compiler>
</operation-settings>
<ddl-file-settings>
<extensions>
<mapping file-type-id="VIEW" extensions="vw" />
<mapping file-type-id="TRIGGER" extensions="trg" />
<mapping file-type-id="PROCEDURE" extensions="prc" />
<mapping file-type-id="FUNCTION" extensions="fnc" />
<mapping file-type-id="PACKAGE" extensions="pkg" />
<mapping file-type-id="PACKAGE_SPEC" extensions="pks" />
<mapping file-type-id="PACKAGE_BODY" extensions="pkb" />
<mapping file-type-id="TYPE" extensions="tpe" />
<mapping file-type-id="TYPE_SPEC" extensions="tps" />
<mapping file-type-id="TYPE_BODY" extensions="tpb" />
<mapping file-type-id="JAVA_SOURCE" extensions="sql" />
</extensions>
<general>
<lookup-ddl-files value="true" />
<create-ddl-files value="false" />
<synchronize-ddl-files value="true" />
<use-qualified-names value="false" />
<make-scripts-rerunnable value="true" />
</general>
</ddl-file-settings>
<assistant-settings>
<credential-settings>
<credentials />
</credential-settings>
</assistant-settings>
<general-settings>
<regional-settings>
<date-format value="MEDIUM" />
<number-format value="UNGROUPED" />
<locale value="SYSTEM_DEFAULT" />
<use-custom-formats value="false" />
</regional-settings>
<environment>
<environment-types>
<environment-type id="development" name="Development" description="Development environment" color="-2430209/-12296320" readonly-code="false" readonly-data="false" />
<environment-type id="integration" name="Integration" description="Integration environment" color="-2621494/-12163514" readonly-code="true" readonly-data="false" />
<environment-type id="production" name="Production" description="Productive environment" color="-11574/-10271420" readonly-code="true" readonly-data="true" />
<environment-type id="other" name="Other" description="" color="-1576/-10724543" readonly-code="false" readonly-data="false" />
</environment-types>
<visibility-settings>
<connection-tabs value="true" />
<dialog-headers value="true" />
<object-editor-tabs value="true" />
<script-editor-tabs value="false" />
<execution-result-tabs value="true" />
</visibility-settings>
</environment>
</general-settings>
</component>
</project>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>

@ -0,0 +1,6 @@
<component name="libraryTable">
<library name="R User Library">
<CLASSES />
<SOURCES />
</library>
</component>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (Blog)" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Blog.iml" filepath="$PROJECT_DIR$/.idea/Blog.iml" />
</modules>
</component>
</project>

@ -0,0 +1,139 @@
"""
Django settings for Blog project.
Generated by 'django-admin startproject' using Django 2.2.24.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
gqc
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '#rbb)%+7w3=5&kj-51b4_d#8y6$v^g9q5lgl@sb$^x*avg7is_'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
gqc# 静态文件配置
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static").replace("\\","/"),
os.path.join(BASE_DIR, '../../static').replace('\\', '/'),
)
gqc# 图片视频资源路径配置
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media').replace("\\", "/")
MEDIA_DIRS = (
os.path.join(BASE_DIR, 'media')
)
gqc# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'HomePage',
'develop' ,
'article' ,
'DjangoUeditor',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'Blog.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'Blog.wsgi.application'
gqc# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = '/static/'

@ -0,0 +1,32 @@
"""Blog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path , re_path
from django.conf.urls import url, include
from .settings import BASE_DIR
from django.views.static import serve
from django.conf import settings
from django.conf.urls.static import static
from HomePage.views import *
urlpatterns = [
path('admin/', admin.site.urls),
path('about/', About, name='aboutsite'),
url(r'^$',include('HomePage.urls')) ,
path('develop/', include('develop.urls') ),
path('article/', include('article.urls')),
path('ueditor/', include('DjangoUeditor.urls')),
re_path(r'^media/upfile/(?P<path>.*)$', serve, {'document_root': BASE_DIR + '/media/upfile'})
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

@ -0,0 +1,16 @@
"""
WSGI config for Blog project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Blog.settings')
application = get_wsgi_application()

@ -0,0 +1,202 @@
# coding:utf-8
try:
# python3
from urllib.request import urljoin as urljoin
except:
# python2
from urllib import basejoin as urljoin
from . import settings as USettings
class UEditorEventHandler(object):
"""用来处理UEditor的事件侦听"""
def on_selectionchange(self):
return ""
def on_contentchange(self):
return ""
def render(self, editorID):
jscode = """
%(editor)s.addListener('%(event)s', function () {
%(event_code)s
});"""
event_codes = []
zjy# 列出所有on_打头的方法然后在ueditor中进行侦听
events = filter(lambda x: x[0:3] == "on_", dir(self))
for event in events:
try:
event_code = getattr(self, event)()
if event_code:
event_code = event_code % {"editor": editorID}
event_codes.append(
jscode % {
"editor": editorID,
"event": event[
3:],
"event_code": event_code})
except:
pass
if len(event_codes) == 0:
return ""
else:
return "\n".join(event_codes)
class UEditorCommand(object):
"""
为前端增加按钮下拉等扩展,
"""
def __init__(self, **kwargs):
self.uiName = kwargs.pop("uiName", "")
self.index = kwargs.pop("index", 0)
self.title = kwargs.pop("title", self.uiName)
self.ajax_url = kwargs.pop("ajax_url", "")
def render_ui(self, editor):
"""" 创建ueditor的ui扩展对象的js代码如button,combo等 """
raise NotImplementedError
def render_ajax_command(self):
""""生成通过ajax调用后端命令的前端ajax代码"""
if not self.ajax_url:
return ""
return u"""
UE.ajax.request( '%(ajax_url)s', {
data: {
name: 'ueditor'
},
onsuccess: function ( xhr ) {%(ajax_success)s},
onerror: function ( xhr ){ %(ajax_error)s }
});
""" % {
"ajax_url": self.ajax_url,
"ajax_success": self.onExecuteAjaxCommand("success"),
"ajax_error": self.onExecuteAjaxCommand("error")
}
def render_command(self):
"""" 返回注册命令的js定义 """
cmd = self.onExecuteCommand()
ajax_cmd = self.render_ajax_command()
queryvalue_command = self.onExecuteQueryvalueCommand()
cmds = []
if cmd or ajax_cmd:
cmds.append(u"""execCommand: function() {
%(exec_cmd)s
%(exec_ajax_cmd)s
}
""" % {"exec_cmd": cmd, "exec_ajax_cmd": ajax_cmd},)
if queryvalue_command:
cmds.append(u"""queryCommandValue:function(){
%s
}""" % queryvalue_command)
if len(cmds) > 0:
return u"""
editor.registerCommand(uiName, {
%s
});
""" % ",".join(cmds)
else:
return ""
def render(self, editorID):
return u"""
UE.registerUI("%(uiName)s", function(editor, uiName) {
%(registerCommand)s
%(uiObject)s
},%(index)s,"%(editor)s");
""" % {
"registerCommand": self.render_command(),
"uiName": self.uiName,
"uiObject": self.render_ui(editorID),
"index": self.index,
"editor": editorID
}
def onExecuteCommand(self):
""" 返回执行Command时的js代码 """
return ""
def onExecuteAjaxCommand(self, state):
""" 返回执行Command时发起Ajax调用成功与失败的js代码 """
return ""
def onExecuteQueryvalueCommand(self):
"""" 返回执行QueryvalueCommand时的js代码 """
return ""
class UEditorButtonCommand(UEditorCommand):
def __init__(self, **kwargs):
self.icon = kwargs.pop("icon", "")
super(UEditorButtonCommand, self).__init__(**kwargs)
def onClick(self):
""""按钮单击js代码默认执行uiName命令默认会调用Command """
return """
editor.execCommand(uiName);
"""
def render_ui(self, editorID):
""" 创建button的js代码: """
return """
var btn = new UE.ui.Button({
name: uiName,
title: "%(title)s",
cssRules: "background-image:url('%(icon)s')!important;",
onclick: function() {
%(onclick)s
}
});
return btn
""" % {
"icon": urljoin(USettings.gSettings.MEDIA_URL, self.icon),
"onclick": self.onClick(),
"title": self.title
}
class UEditorComboCommand(UEditorCommand):
def __init__(self, **kwargs):
self.items = kwargs.pop("items", [])
self.initValue = kwargs.pop("initValue", "")
super(UEditorComboCommand, self).__init__(**kwargs)
def get_items(self):
return self.items
def onSelect(self):
return ""
def render_ui(self, editorID):
""" 创建combo的js代码: """
return """
var combox = new UE.ui.Combox({
editor:editor,
items:%(items)s,
onselect:function (t, index) {
%(onselect)s
},
title:'%(title)s',
initValue:'%(initValue)s'
});
return combox;
""" % {
"title": self.title,
"items": str(self.get_items()),
"onselect": self.onSelect(),
"initValue": self.initValue
}
class UEditorDialogCommand(UEditorCommand):
pass

@ -0,0 +1,65 @@
# coding: utf-8
from django import forms
from widgets import UEditorWidget
from DjangoUeditor.models import UEditorField as ModelUEditorField
class UEditorField(forms.CharField):
def __init__(
self,
label,
width=600,
height=300,
toolbars="full",
imagePath="",
filePath="",
upload_settings={},
settings={},
command=None,
event_handler=None,
*args,
**kwargs):
uSettings = locals().copy()
del uSettings["self"], uSettings[
"label"], uSettings["args"], uSettings["kwargs"]
kwargs["widget"] = UEditorWidget(attrs=uSettings)
kwargs["label"] = label
super(UEditorField, self).__init__(*args, **kwargs)
zjy# def UpdateUploadPath(model_form, model_inst=None):
# """ 遍历model字段如果是UEditorField则需要重新计算路径 """
# if model_inst is not None:
# try:
# for field in model_inst._meta.fields:
# if isinstance(field, ModelUEditorField):
# model_form.__getitem__(
# field.name).field.widget.recalc_path(model_inst)
# except:
# pass
zjy# 修改前
def UpdateUploadPath(model_form, model_inst=None):
""" 遍历model字段如果是UEditorField则需要重新计算路径 """
if not model_inst:
try:
for field in model_inst._meta.fields:
if isinstance(field, ModelUEditorField):
model_form.__getitem__(
field.name).field.widget.recalc_path(model_inst)
except:
pass
class UEditorModelForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(UEditorModelForm, self).__init__(*args, **kwargs)
try:
if "instance" in kwargs:
UpdateUploadPath(self, kwargs["instance"])
else:
UpdateUploadPath(self, None)
except Exception:
pass

@ -0,0 +1,48 @@
# coding: utf-8
from django.db import models
from django.contrib.admin import widgets as admin_widgets
from .widgets import UEditorWidget, AdminUEditorWidget
class UEditorField(models.TextField):
"""
百度HTML编辑器字段,初始化时可以提供以下参数
initial:初始内容
toolbars:提供工具按钮列表,取值为列表['bold', 'italic'],取值为mini,normal,full代表小一般全部
imagePath:图片上传的路径,"images/",实现上传到"{{MEDIA_ROOT}}/images"文件夹
filePath:附件上传的路径,"files/",实现上传到"{{MEDIA_ROOT}}/files"文件夹
"""
def __init__(
self,
verbose_name=None,
width=600,
height=300,
toolbars="full",
imagePath="",
filePath="",
upload_settings={},
settings={},
command=None,
event_handler=None,
**kwargs):
self.ueditor_settings = locals().copy()
kwargs["verbose_name"] = verbose_name
del self.ueditor_settings["self"], self.ueditor_settings[
"kwargs"], self.ueditor_settings["verbose_name"]
super(UEditorField, self).__init__(**kwargs)
def formfield(self, **kwargs):
defaults = {'widget': UEditorWidget(attrs=self.ueditor_settings)}
defaults.update(kwargs)
if defaults['widget'] == admin_widgets.AdminTextareaWidget:
defaults['widget'] = AdminUEditorWidget(
attrs=self.ueditor_settings)
return super(UEditorField, self).formfield(**defaults)
# 以下支持south
try:
from south.modelsinspector import add_introspection_rules
add_introspection_rules([], ["^DjangoUeditor\.models\.UEditorField"])
except:
pass

@ -0,0 +1,215 @@
# coding:utf-8
from django.conf import settings as gSettings # 全局设置
# 工具栏样式,可以添加任意多的模式
TOOLBARS_SETTINGS = {"besttome": [['source',
'undo',
'redo',
'bold',
'italic',
'underline',
'forecolor',
'backcolor',
'superscript',
'subscript',
"justifyleft",
"justifycenter",
"justifyright",
"insertorderedlist",
"insertunorderedlist",
"blockquote",
'formatmatch',
"removeformat",
'autotypeset',
'inserttable',
"pasteplain",
"wordimage",
"searchreplace",
"map",
"preview",
"fullscreen"],
['insertcode',
'paragraph',
"fontfamily",
"fontsize",
'link',
'unlink',
'insertimage',
'insertvideo',
'attachment',
'emotion',
"date",
"time"]],
"mini": [['source',
'|',
'undo',
'redo',
'|',
'bold',
'italic',
'underline',
'formatmatch',
'autotypeset',
'|',
'forecolor',
'backcolor',
'|',
'link',
'unlink',
'|',
'simpleupload',
'attachment']],
"normal": [['source',
'|',
'undo',
'redo',
'|',
'bold',
'italic',
'underline',
'removeformat',
'formatmatch',
'autotypeset',
'|',
'forecolor',
'backcolor',
'|',
'link',
'unlink',
'|',
'simpleupload',
'emotion',
'attachment',
'|',
'inserttable',
'deletetable',
'insertparagraphbeforetable',
'insertrow',
'deleterow',
'insertcol',
'deletecol',
'mergecells',
'mergeright',
'mergedown',
'splittocells',
'splittorows',
'splittocols']]}
# 默认的Ueditor设置请参见ueditor.config.js
UEditorSettings = {
"toolbars": TOOLBARS_SETTINGS["normal"],
"autoFloatEnabled": False,
# 默认保存上传文件的命名方式
"defaultPathFormat": "%(basename)s_%(datetime)s_%(rnd)s.%(extname)s"
}
# 请参阅php文件夹里面的config.json进行配置
UEditorUploadSettings = {
# 上传图片配置项
"imageActionName": "uploadimage", # 执行上传图片的action名称
"imageMaxSize": 10485760, # 上传大小限制单位B,10M
"imageFieldName": "upfile", # * 提交的图片表单名称 */
"imageUrlPrefix": "",
"imagePathFormat": "",
"imageAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], # 上传图片格式显示
# 涂鸦图片上传配置项 */
"scrawlActionName": "uploadscrawl", # 执行上传涂鸦的action名称 */
"scrawlFieldName": "upfile", # 提交的图片表单名称 */
"scrawlMaxSize": 10485760, # 上传大小限制单位B 10M
"scrawlUrlPrefix": "",
"scrawlPathFormat": "",
# 截图工具上传 */
"snapscreenActionName": "uploadimage", # 执行上传截图的action名称 */
"snapscreenPathFormat": "",
"snapscreenUrlPrefix": "",
# 抓取远程图片配置 */
"catcherLocalDomain": ["127.0.0.1", "localhost", "img.baidu.com"],
"catcherPathFormat": "",
"catcherActionName": "catchimage", # 执行抓取远程图片的action名称 */
"catcherFieldName": "source", # 提交的图片列表表单名称 */
"catcherMaxSize": 10485760, # 上传大小限制单位B */
# 抓取图片格式显示 */
"catcherAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"],
"catcherUrlPrefix": "",
# 上传视频配置 */
"videoActionName": "uploadvideo", # 执行上传视频的action名称 */
"videoPathFormat": "",
"videoFieldName": "upfile", # 提交的视频表单名称 */
"videoMaxSize": 102400000, # 上传大小限制单位B默认100MB */
"videoUrlPrefix": "",
"videoAllowFiles": [
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid"], # 上传视频格式显示 */
# 上传文件配置 */
"fileActionName": "uploadfile", # controller里,执行上传视频的action名称 */
"filePathFormat": "",
"fileFieldName": "upfile", # 提交的文件表单名称 */
"fileMaxSize": 204800000, # 上传大小限制单位B200MB */
"fileUrlPrefix": "", # 文件访问路径前缀 */
"fileAllowFiles": [
".png", ".jpg", ".jpeg", ".gif", ".bmp",
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
], # 上传文件格式显示 */
# 列出指定目录下的图片 */
"imageManagerActionName": "listimage", # 执行图片管理的action名称 */
"imageManagerListPath": "",
"imageManagerListSize": 30, # 每次列出文件数量 */
# 列出的文件类型 */
"imageManagerAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"],
"imageManagerUrlPrefix": "", # 图片访问路径前缀 */
# 列出指定目录下的文件 */
"fileManagerActionName": "listfile", # 执行文件管理的action名称 */
"fileManagerListPath": "",
"fileManagerUrlPrefix": "",
"fileManagerListSize": 30, # 每次列出文件数量 */
"fileManagerAllowFiles": [
".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tif", ".psd"
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml",
".exe", ".com", ".dll", ".msi"
] # 列出的文件类型 */
}
# 修改前的
# 更新配置从用户配置文件settings.py重新读入配置UEDITOR_SETTINGS,覆盖默认
# def UpdateUserSettings():
# UserSettings = getattr(gSettings, "UEDITOR_SETTINGS", {}).copy()
# if UserSettings.get("config", None):
# UEditorSettings.update(UserSettings["config"])
# if UserSettings.get("upload", None):
# UEditorUploadSettings.update(UserSettings["upload"])
def UpdateUserSettings():
UserSettings = getattr(gSettings, "UEDITOR_SETTINGS", {}).copy()
if "config" in UserSettings:
UEditorSettings.update(UserSettings["config"])
if "upload" in UserSettings:
UEditorUploadSettings.update(UserSettings["upload"])
# 读取用户Settings文件并覆盖默认配置
UpdateUserSettings()
# 修改前的
# 取得配置项参数
# def GetUeditorSettings(key, default=None):
# if UEditorSettings.get(key, None):
# return UEditorSettings[key]
# else:
# return default
def GetUeditorSettings(key, default=None):
if key in UEditorSettings:
return UEditorSettings[key]
else:
return default

@ -0,0 +1,38 @@
UE.registerUI('button',function(editor,uiName){
//注册按钮执行时的command命令使用命令默认就会带有回退操作
editor.registerCommand(uiName,{
execCommand:function(){
alert('execCommand:' + uiName)
}
});
//创建一个button
var btn = new UE.ui.Button({
//按钮的名字
name:uiName,
//提示
title:uiName,
//需要添加的额外样式指定icon图标这里默认使用一个重复的icon
cssRules :'background-position: -500px 0;',
//点击时执行的命令
onclick:function () {
//这里可以不用执行命令,做你自己的操作也可
editor.execCommand(uiName);
}
});
//当点到编辑内容上时,按钮要做的状态反射
editor.addListener('selectionchange', function () {
var state = editor.queryCommandState(uiName);
if (state == -1) {
btn.setDisabled(true);
btn.setChecked(false);
} else {
btn.setDisabled(false);
btn.setChecked(state);
}
});
//因为你是添加button,所以需要返回这个button
return btn;
}/*index 指定添加到工具栏上的那个位置,默认时追加到最后,editorId 指定这个UI是那个编辑器实例上的默认是页面上所有的编辑器都会添加这个按钮*/);

@ -0,0 +1,69 @@
UE.registerUI('combox',function(editor,uiName){
//注册按钮执行时的command命令,用uiName作为command名字使用命令默认就会带有回退操作
editor.registerCommand(uiName,{
execCommand:function(cmdName,value){
//这里借用fontsize的命令
this.execCommand('fontsize',value + 'px')
},
queryCommandValue:function(){
//这里借用fontsize的查询命令
return this.queryCommandValue('fontsize')
}
});
//创建下拉菜单中的键值对,这里我用字体大小作为例子
var items = [];
for(var i= 0,ci;ci=[10, 11, 12, 14, 16, 18, 20, 24, 36][i++];){
items.push({
//显示的条目
label:'字体:' + ci + 'px',
//选中条目后的返回值
value:ci,
//针对每个条目进行特殊的渲染
renderLabelHtml:function () {
//这个是希望每个条目的字体是不同的
return '<div class="edui-label %%-label" style="line-height:2;font-size:' +
this.value + 'px;">' + (this.label || '') + '</div>';
}
});
}
//创建下来框
var combox = new UE.ui.Combox({
//需要指定当前的编辑器实例
editor:editor,
//添加条目
items:items,
//当选中时要做的事情
onselect:function (t, index) {
//拿到选中条目的值
editor.execCommand(uiName, this.items[index].value);
},
//提示
title:uiName,
//当编辑器没有焦点时combox默认显示的内容
initValue:uiName
});
editor.addListener('selectionchange', function (type, causeByUi, uiReady) {
if (!uiReady) {
var state = editor.queryCommandState(uiName);
if (state == -1) {
combox.setDisabled(true);
} else {
combox.setDisabled(false);
var value = editor.queryCommandValue(uiName);
if(!value){
combox.setValue(uiName);
return;
}
//ie下从源码模式切换回来时字体会带单引号而且会有逗号
value && (value = value.replace(/['"]/g, '').split(',')[0]);
combox.setValue(value);
}
}
});
return combox;
},2/*index 指定添加到工具栏上的那个位置,默认时追加到最后,editorId 指定这个UI是那个编辑器实例上的默认是页面上所有的编辑器都会添加这个按钮*/);

@ -0,0 +1,49 @@
UE.registerUI('dialog',function(editor,uiName){
//创建dialog
var dialog = new UE.ui.Dialog({
//指定弹出层中页面的路径,这里只能支持页面,因为跟addCustomizeDialog.js相同目录所以无需加路径
iframeUrl:'customizeDialogPage.html',
//需要指定当前的编辑器实例
editor:editor,
//指定dialog的名字
name:uiName,
//dialog的标题
title:"这是个测试浮层",
//指定dialog的外围样式
cssRules:"width:600px;height:300px;",
//如果给出了buttons就代表dialog有确定和取消
buttons:[
{
className:'edui-okbutton',
label:'确定',
onclick:function () {
dialog.close(true);
}
},
{
className:'edui-cancelbutton',
label:'取消',
onclick:function () {
dialog.close(false);
}
}
]});
//参考addCustomizeButton.js
var btn = new UE.ui.Button({
name:'dialogbutton' + uiName,
title:'dialogbutton' + uiName,
//需要添加的额外样式指定icon图标这里默认使用一个重复的icon
cssRules :'background-position: -500px 0;',
onclick:function () {
//渲染dialog
dialog.render();
dialog.open();
}
});
return btn;
}/*index 指定添加到工具栏上的那个位置,默认时追加到最后,editorId 指定这个UI是那个编辑器实例上的默认是页面上所有的编辑器都会添加这个按钮*/);

@ -0,0 +1,71 @@
<!DOCTYPE HTML>
<html>
<head>
<title>图表demo</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<!--建议手动加在语言避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="../lang/zh-cn/zh-cn.js"></script>
<style type="text/css">
.clear {
clear: both;
}
</style>
</head>
<body>
<div>
<script id="editor" type="text/plain" style="width:1024px;height:500px;">
<h1>测试图表请点击表格, 然后点击工具栏上的“图表”按钮</h1>
<table data-chart="title:2012北京房价趋势图;subTitle:;xTitle:月份;yTitle:金额(元);suffix:元;tip:;dataFormat:1;chartType:0">
<tbody>
<tr>
<th width="90"><br></th>
<th width="90">1月</th>
<th width="90">2月</th>
<th width="90">3月</th>
<th width="90">4月</th>
<th width="90">5月</th>
<th width="90">6月</th>
<th width="90">7月</th>
<th width="90">8月</th>
<th width="90">9月</th>
<th width="91">10月</th>
<th>11月</th>
<th>12月</th>
</tr>
<tr>
<th valign="null" width="90">2012</th>
<td valign="top" width="55">24593</td>
<td valign="top" width="55">24308</td>
<td valign="top" width="55">24932</td>
<td valign="top" width="55">25413</td>
<td valign="top" width="55">25588</td>
<td valign="top" width="55">25948</td>
<td valign="top" width="55">26579</td>
<td valign="top" width="55">27199</td>
<td valign="top" width="55">28392</td>
<td valign="top" width="55">29071</td>
<td valign="top" width="55">29522</td>
<td valign="top" width="55">30158</td>
</tr>
</tbody>
</table>
</script>
</div>
<script type="text/javascript">
//实例化编辑器
var ue = UE.getEditor('editor', {
toolbars: [
[
'charts', 'preview'
]
]
});
</script>
</body>
</html>

@ -0,0 +1,175 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>完整demo</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"> </script>
<!--建议手动加在语言避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="../lang/zh-cn/zh-cn.js"></script>
<style type="text/css">
div{
width:100%;
}
</style>
</head>
<body>
<div>
<h1>完整demo</h1>
<script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>
</div>
<div id="btns">
<div>
<button onclick="getAllHtml()">获得整个html的内容</button>
<button onclick="getContent()">获得内容</button>
<button onclick="setContent()">写入内容</button>
<button onclick="setContent(true)">追加内容</button>
<button onclick="getContentTxt()">获得纯文本</button>
<button onclick="getPlainTxt()">获得带格式的纯文本</button>
<button onclick="hasContent()">判断是否有内容</button>
<button onclick="setFocus()">使编辑器获得焦点</button>
<button onmousedown="isFocus(event)">编辑器是否获得焦点</button>
<button onmousedown="setblur(event)" >编辑器失去焦点</button>
</div>
<div>
<button onclick="getText()">获得当前选中的文本</button>
<button onclick="insertHtml()">插入给定的内容</button>
<button id="enable" onclick="setEnabled()">可以编辑</button>
<button onclick="setDisabled()">不可编辑</button>
<button onclick=" UE.getEditor('editor').setHide()">隐藏编辑器</button>
<button onclick=" UE.getEditor('editor').setShow()">显示编辑器</button>
<button onclick=" UE.getEditor('editor').setHeight(300)">设置高度为300默认关闭了自动长高</button>
</div>
<div>
<button onclick="getLocalData()" >获取草稿箱内容</button>
<button onclick="clearLocalData()" >清空草稿箱</button>
</div>
</div>
<div>
<button onclick="createEditor()">
创建编辑器</button>
<button onclick="deleteEditor()">
删除编辑器</button>
</div>
<script type="text/javascript">
//实例化编辑器
//建议使用工厂方法getEditor创建和引用编辑器实例如果在某个闭包下引用该编辑器直接调用UE.getEditor('editor')就能拿到相关的实例
var ue = UE.getEditor('editor');
function isFocus(e){
alert(UE.getEditor('editor').isFocus());
UE.dom.domUtils.preventDefault(e)
}
function setblur(e){
UE.getEditor('editor').blur();
UE.dom.domUtils.preventDefault(e)
}
function insertHtml() {
var value = prompt('插入html代码', '');
UE.getEditor('editor').execCommand('insertHtml', value)
}
function createEditor() {
enableBtn();
UE.getEditor('editor');
}
function getAllHtml() {
alert(UE.getEditor('editor').getAllHtml())
}
function getContent() {
var arr = [];
arr.push("使用editor.getContent()方法可以获得编辑器的内容");
arr.push("内容为:");
arr.push(UE.getEditor('editor').getContent());
alert(arr.join("\n"));
}
function getPlainTxt() {
var arr = [];
arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
arr.push("内容为:");
arr.push(UE.getEditor('editor').getPlainTxt());
alert(arr.join('\n'))
}
function setContent(isAppendTo) {
var arr = [];
arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容");
UE.getEditor('editor').setContent('欢迎使用ueditor', isAppendTo);
alert(arr.join("\n"));
}
function setDisabled() {
UE.getEditor('editor').setDisabled('fullscreen');
disableBtn("enable");
}
function setEnabled() {
UE.getEditor('editor').setEnabled();
enableBtn();
}
function getText() {
//当你点击按钮时编辑区域已经失去了焦点如果直接用getText将不会得到内容所以要在选回来然后取得内容
var range = UE.getEditor('editor').selection.getRange();
range.select();
var txt = UE.getEditor('editor').selection.getText();
alert(txt)
}
function getContentTxt() {
var arr = [];
arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
arr.push("编辑器的纯文本内容为:");
arr.push(UE.getEditor('editor').getContentTxt());
alert(arr.join("\n"));
}
function hasContent() {
var arr = [];
arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
arr.push("判断结果为:");
arr.push(UE.getEditor('editor').hasContents());
alert(arr.join("\n"));
}
function setFocus() {
UE.getEditor('editor').focus();
}
function deleteEditor() {
disableBtn();
UE.getEditor('editor').destroy();
}
function disableBtn(str) {
var div = document.getElementById('btns');
var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
for (var i = 0, btn; btn = btns[i++];) {
if (btn.id == str) {
UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
} else {
btn.setAttribute("disabled", "true");
}
}
}
function enableBtn() {
var div = document.getElementById('btns');
var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
for (var i = 0, btn; btn = btns[i++];) {
UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
}
}
function getLocalData () {
alert(UE.getEditor('editor').execCommand( "getlocaldata" ));
}
function clearLocalData () {
UE.getEditor('editor').execCommand( "clearlocaldata" );
alert("已清空草稿箱")
}
</script>
</body>
</html>

@ -0,0 +1,54 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title></title>
<script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
</head>
<body>
<h1>UEditor自定义插件</h1>
<!--style给定宽度可以影响编辑器的最终宽度-->
<script type="text/plain" id="myEditor">
<p><img src="http://ueditor.baidu.com/website/images/banner-dl.png" alt=""></p>
<p>插件描述:选中图片,在其上单击,会改变图片的边框!</p>
</script>
<script type="text/javascript">
//创建一个在选中的图片单击时添加边框的插件其实质就是在baidu.editor.plugins塞进一个闭包
UE.plugins["addborder"] = function () {
var me = this;
//创建一个改变图片边框的命令
me.commands["addborder"] = {
execCommand:function () {
//获取当前选区
var range = me.selection.getRange();
//选区没闭合的情况下操作
if ( !range.collapsed ) {
//图片判断
var img = range.getClosedNode();
if ( img && img.tagName == "IMG" ) {
//点击切换图片边框
img.style.border = img.style.borderWidth == "5px"?"1px":"5px solid red";
}
}
}
};
//注册一个触发命令的事件,同学们可以在任意地放绑定触发此命令的事件
me.addListener( 'click', function () {
setTimeout(function(){
me.execCommand( "addborder" );
})
} );
};
var editor_a = UE.getEditor('myEditor' );
</script>
</body>
</html>

@ -0,0 +1,105 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title></title>
<script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<style type="text/css">
#editor {
border: 1px solid #CCC;
width: 1000px
}
#editor_toolbar_box {
background: #F0F0EE;
padding: 2px;
}
#editor_iframe_holder {
border-top: 1px solid #CCC;
border-bottom: 1px solid #CCC;
}
</style>
</head>
<body>
<h1>UEditor自定义toolbar</h1>
<div id="editor">
<div id="editor_toolbar_box">
<div id="editor_toolbar">
<input id="bold" type="button" value="加粗" onclick="myeditor.execCommand('bold')" style="height:24px;line-height:20px"/>
<input id="italic" type="button" value="加斜" onclick="myeditor.execCommand('italic')" style="height:24px;line-height:20px"/>
<select id="fontfamily" onchange="myeditor.execCommand('fontfamily',this.value)">
<option value="宋体,simsun">宋体</option>
<option value="楷体,楷体_gb2312,simkai">楷体</option>
<option value="隶书,simli">隶书</option>
<option value="黑体,simhei">黑体</option>
<option value="andale mono,times">andale mono</option>
<option value="arial,helvetica,sans-serif">arial</option>
<option value="arial black,avant garde">arial black</option>
<option value="comic sans ms,sans-serif">comic sans ms</option>
</select>
<select id="fontsize" onchange="myeditor.execCommand('fontsize',this.value)">
<option value="10pt">10pt</option>
<option value="11pt">11pt</option>
<option value="12pt">12pt</option>
<option value="14pt">14pt</option>
<option value="16pt">16pt</option>
<option value="18pt">18pt</option>
<option value="20pt">20pt</option>
<option value="22pt">22pt</option>
<option value="24pt">24pt</option>
<option value="36pt">36pt</option>
</select>
<input type="button" value="插入html" onclick="insert()" style="height:24px;line-height:20px"/>
<input type="button" value="清除格式" onclick="myeditor.execCommand('removeformat')" style="height:24px;line-height:20px"/>
<input type="button" value="获得编辑器内容" onclick="alert(myeditor.getContent())" style="height:24px;line-height:20px"/>
<input type="button" value="获得编辑器纯文本内容" onclick="alert(myeditor.getContentTxt())" style="height:24px;line-height:20px"/>
</div>
</div>
<div id="editor_iframe_holder" ></div>
</div>
<script type="text/javascript" charset="utf-8">
function $G(id){
return document.getElementById(id);
}
//实例化一个不带ui的编辑器,注意此处的实例化对象是baidu.editor下的Editor而非baidu.editor.ui下的Editor
var myeditor = UE.getEditor('editor_iframe_holder',{
toolbars:[[]],
initialContent: '初始化内容',//初始化编辑器的内容
initialFrameHeight: 200
});
//给编辑器增加一个选中改变的事件,用来判断所选内容以及状态
myeditor.addListener('selectionchange', function (){
var cmdName = ['bold','italic'],//命令列表
fontName = ['fontfamily','fontsize'];//字体设置下拉框列表,此处选择其中两个
//查询每个命令当前的状态,并设置对应状态样式
var i =-1;
while(i++ < cmdName.length-1){
var state = myeditor.queryCommandState(cmdName[i]);
$G(cmdName[i]).style.color = state == 1?"red":"";
}
//依据当前光标所在的字体改变下拉列表的选中值
i = -1;
while(i++<fontName.length-1){
var fstate = myeditor.queryCommandValue(fontName[i]).toLowerCase();
var fselect = $G(fontName[i]);
for(var j= 0;j<fselect.options.length;j++){
if(fselect.options[j].value.toLowerCase().indexOf(fstate.split(",")[0])!=-1){
fselect.options[j].selected = "true";
}
}
}
});
//插入文本
function insert(){
var insertTxt = "插入的文本";
insertTxt = prompt("插入的内容",insertTxt);
insertTxt&&myeditor.execCommand("inserthtml",insertTxt);
}
function execUnderline(cmd){
myeditor.execCommand(cmd);
}
</script>
</body>
</html>

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<div class="content">
<h1>测试页面</h1>
</div>
<!--页面中一定要引入internal.js为了能直接使用当前打开dialog的实例变量-->
<!--internal.js默认是放到dialogs目录下的-->
<script type="text/javascript" src="../dialogs/internal.js"></script>
<script>
//可以直接使用以下全局变量
//当前打开dialog的实例变量
alert('editor: '+editor);
//一些常用工具
alert('domUtils: '+domUtils);
alert('utils: '+utils);
alert('browser: '+browser);
</script>
</body>
</html>

@ -0,0 +1,43 @@
<!DOCTYPE HTML>
<html>
<head>
<title>完整demo</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"> </script>
<!--建议手动加在语言避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="../lang/zh-cn/zh-cn.js"></script>
<!--添加按钮-->
<script type="text/javascript" charset="utf-8" src="addCustomizeButton.js"></script>
<!--添加下拉菜单-->
<script type="text/javascript" charset="utf-8" src="addCustomizeCombox.js"></script>
<!--添加弹出层-->
<script type="text/javascript" charset="utf-8" src="addCustomizeDialog.js"></script>
<style type="text/css">
.clear {
clear: both;
}
div{
width:100%;
}
</style>
</head>
<body>
<div>
<h1>二次开发demo</h1>
<script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>
</div>
</body>
<script type="text/javascript">
//实例化编辑器
//建议使用工厂方法getEditor创建和引用编辑器实例如果在某个闭包下引用该编辑器直接调用UE.getEditor('editor')就能拿到相关的实例
UE.getEditor('editor',{
//清空了工具栏
toolbars:[[]]
})
</script>
</html>

@ -0,0 +1,129 @@
/**
* 开发版本的文件导入
*/
(function (){
var paths = [
'editor.js',
'core/browser.js',
'core/utils.js',
'core/EventBase.js',
'core/dtd.js',
'core/domUtils.js',
'core/Range.js',
'core/Selection.js',
'core/Editor.js',
'core/Editor.defaultoptions.js',
'core/loadconfig.js',
'core/ajax.js',
'core/filterword.js',
'core/node.js',
'core/htmlparser.js',
'core/filternode.js',
'core/plugin.js',
'core/keymap.js',
'core/localstorage.js',
'plugins/defaultfilter.js',
'plugins/inserthtml.js',
'plugins/autotypeset.js',
'plugins/autosubmit.js',
'plugins/background.js',
'plugins/image.js',
'plugins/justify.js',
'plugins/font.js',
'plugins/link.js',
'plugins/iframe.js',
'plugins/scrawl.js',
'plugins/removeformat.js',
'plugins/blockquote.js',
'plugins/convertcase.js',
'plugins/indent.js',
'plugins/print.js',
'plugins/preview.js',
'plugins/selectall.js',
'plugins/paragraph.js',
'plugins/directionality.js',
'plugins/horizontal.js',
'plugins/time.js',
'plugins/rowspacing.js',
'plugins/lineheight.js',
'plugins/insertcode.js',
'plugins/cleardoc.js',
'plugins/anchor.js',
'plugins/wordcount.js',
'plugins/pagebreak.js',
'plugins/wordimage.js',
'plugins/dragdrop.js',
'plugins/undo.js',
'plugins/copy.js',
'plugins/paste.js',
'plugins/puretxtpaste.js',
'plugins/list.js',
'plugins/source.js',
'plugins/enterkey.js',
'plugins/keystrokes.js',
'plugins/fiximgclick.js',
'plugins/autolink.js',
'plugins/autoheight.js',
'plugins/autofloat.js',
'plugins/video.js',
'plugins/table.core.js',
'plugins/table.cmds.js',
'plugins/table.action.js',
'plugins/table.sort.js',
'plugins/contextmenu.js',
'plugins/shortcutmenu.js',
'plugins/basestyle.js',
'plugins/elementpath.js',
'plugins/formatmatch.js',
'plugins/searchreplace.js',
'plugins/customstyle.js',
'plugins/catchremoteimage.js',
'plugins/snapscreen.js',
'plugins/insertparagraph.js',
'plugins/webapp.js',
'plugins/template.js',
'plugins/music.js',
'plugins/autoupload.js',
'plugins/autosave.js',
'plugins/charts.js',
'plugins/section.js',
'plugins/simpleupload.js',
'plugins/serverparam.js',
'plugins/insertfile.js',
'ui/ui.js',
'ui/uiutils.js',
'ui/uibase.js',
'ui/separator.js',
'ui/mask.js',
'ui/popup.js',
'ui/colorpicker.js',
'ui/tablepicker.js',
'ui/stateful.js',
'ui/button.js',
'ui/splitbutton.js',
'ui/colorbutton.js',
'ui/tablebutton.js',
'ui/autotypesetpicker.js',
'ui/autotypesetbutton.js',
'ui/cellalignpicker.js',
'ui/pastepicker.js',
'ui/toolbar.js',
'ui/menu.js',
'ui/combox.js',
'ui/dialog.js',
'ui/menubutton.js',
'ui/multiMenu.js',
'ui/shortcutmenu.js',
'ui/breakline.js',
'ui/message.js',
'adapter/editorui.js',
'adapter/editor.js',
'adapter/message.js',
'adapter/autosave.js'
],
baseURL = '../_src/';
for (var i=0,pi;pi = paths[i++];) {
document.write('<script type="text/javascript" src="'+ baseURL + pi +'"></script>');
}
})();

@ -0,0 +1,151 @@
<!DOCTYPE HTML>
<html>
<head>
<title>过滤规则定制化</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<style type="text/css">
.clear {
clear: both;
}
</style>
</head>
<body>
<p>尝试粘贴内容近来这里边不能粘贴任何inline的样式不能有iframe,style,script,embed等标签表格不能嵌套</p>
<div>
<script id="editor" type="text/plain" style="width:500px;height:500px"></script>
</div>
</body>
<script type="text/javascript">
UE.getEditor('editor', {
filterRules: function () {
return{
span:function(node){
if(/Wingdings|Symbol/.test(node.getStyle('font-family'))){
return true;
}else{
node.parentNode.removeChild(node,true)
}
},
p: function(node){
var listTag;
if(node.getAttr('class') == 'MsoListParagraph'){
listTag = 'MsoListParagraph'
}
node.setAttr();
if(listTag){
node.setAttr('class','MsoListParagraph')
}
if(!node.firstChild()){
node.innerHTML(UE.browser.ie ? '&nbsp;' : '<br>')
}
},
div: function (node) {
var tmpNode, p = UE.uNode.createElement('p');
while (tmpNode = node.firstChild()) {
if (tmpNode.type == 'text' || !UE.dom.dtd.$block[tmpNode.tagName]) {
p.appendChild(tmpNode);
} else {
if (p.firstChild()) {
node.parentNode.insertBefore(p, node);
p = UE.uNode.createElement('p');
} else {
node.parentNode.insertBefore(tmpNode, node);
}
}
}
if (p.firstChild()) {
node.parentNode.insertBefore(p, node);
}
node.parentNode.removeChild(node);
},
//$:{}表示不保留任何属性
br: {$: {}},
// a: function (node) {
// if(!node.firstChild()){
// node.parentNode.removeChild(node);
// return;
// }
// node.setAttr();
// node.setAttr('href', '#')
// },
// strong: {$: {}},
// b:function(node){
// node.tagName = 'strong'
// },
// i:function(node){
// node.tagName = 'em'
// },
// em: {$: {}},
// img: function (node) {
// var src = node.getAttr('src');
// node.setAttr();
// node.setAttr({'src':src})
// },
ol:{$: {}},
ul: {$: {}},
dl:function(node){
node.tagName = 'ul';
node.setAttr()
},
dt:function(node){
node.tagName = 'li';
node.setAttr()
},
dd:function(node){
node.tagName = 'li';
node.setAttr()
},
li: function (node) {
var className = node.getAttr('class');
if (!className || !/list\-/.test(className)) {
node.setAttr()
}
var tmpNodes = node.getNodesByTagName('ol ul');
UE.utils.each(tmpNodes,function(n){
node.parentNode.insertAfter(n,node);
})
},
table: function (node) {
UE.utils.each(node.getNodesByTagName('table'), function (t) {
UE.utils.each(t.getNodesByTagName('tr'), function (tr) {
var p = UE.uNode.createElement('p'), child, html = [];
while (child = tr.firstChild()) {
html.push(child.innerHTML());
tr.removeChild(child);
}
p.innerHTML(html.join('&nbsp;&nbsp;'));
t.parentNode.insertBefore(p, t);
})
t.parentNode.removeChild(t)
});
var val = node.getAttr('width');
node.setAttr();
if (val) {
node.setAttr('width', val);
}
},
tbody: {$: {}},
caption: {$: {}},
th: {$: {}},
td: {$: {valign: 1, align: 1,rowspan:1,colspan:1,width:1,height:1}},
tr: {$: {}},
h3: {$: {}},
h2: {$: {}},
//黑名单,以下标签及其子节点都会被过滤掉
'-': 'script style meta iframe embed object'
}
}()
});
</script>
</html>

@ -0,0 +1,39 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title></title>
<script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<!--加入高亮的js和css文件如果你的编辑器和展示也是一个页面那么高亮的js可以不加载-->
<script type="text/javascript" charset="utf-8" src="../third-party/SyntaxHighlighter/shCore.js"></script>
<link rel="stylesheet" type="text/css" href="../third-party/SyntaxHighlighter/shCoreDefault.css"/>
</head>
<body>
<h1>代码高亮演示</h1>
<h2>获得编辑器实例</h2>
<div style="width:200px">
<pre class="brush:js;toolbar:false;">
UE.getEditor('myEditor');
</pre>
</div>
<!--style给定宽度可以影响编辑器的最终宽度-->
<script type="text/plain" id="myEditor" style="width:500px">
<h3>实例化编辑器</h3>
<pre class="brush:js;toolbar:false;">
UE.getEditor('myEditor');
</pre>
</script>
<script type="text/javascript">
//为了在编辑器之外能展示高亮代码
SyntaxHighlighter.highlight();
UE.getEditor('myEditor');
</script>
</body>
</html>

@ -0,0 +1,118 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
h3{
color:#630000;
}
ul li{
margin: 10px;
}
a:link,a:active,a:visited{
color: #0000EE;
}
a{
text-decoration: none;
}
</style>
</head>
<body>
<h2>UEditor各种实例演示</h2>
<h3>基础示例</h3>
<ul>
<li>
<a href="simpleDemo.html" target="_self">简单示例</a><br/>
使用基础的按钮实现简单的功能
</li>
</ul>
<h3>应用展示</h3>
<ul>
<li>
<a href="submitFormDemo.html" target="_self">表单应用</a><br/>
编辑器的内容通过表单提交到后台
</li>
<li>
<a href="resetDemo.html" target="_self">重置编辑器</a><br/>
将编辑器的内部变量清空,重置。
</li>
<li>
<a href="textareaDemo.html" target="_self">文本域渲染编辑器</a><br/>
将编辑器渲染到文本域,并且将文本域的内容放到编辑器的初始化内容里
</li>
</ul>
<h3>二次开发</h3>
<ul>
<li>
<a style="color:red;" href="customizeToolbarUIDemo.html" target="_self">二次开发例子</a><br/>
添加自定义的普通按钮、下拉菜单按钮、对话框按钮
</li>
<li>
<a href="customToolbarDemo.html" target="_self">自定义Toolbar</a><br/>
用自己的皮肤,设计自己的编辑器
</li>
<li>
<a href="customPluginDemo.html" target="_self">自定义插件</a><br/>
在编辑器的基础上开发自己的插件
</li>
</ul>
<h3>高级案例</h3>
<ul>
<li>
<a href="completeDemo.html" target="_self">完整示例</a><br/>
编辑器的完整功能
</li>
<li>
<a href="charts.html" target="_self" >图表示例</a><br/>
图表功能
</li>
<li>
<a href="sortableDemo.html" target="_self" >表格排序示例</a><br/>
编辑表格,并设置排序后可在展示区域点击排序
</li>
<li>
<a href="sectionDemo.html" target="_self" >目录大纲示例</a><br/>
获取编辑内容的目录大纲,并通过操作目录,更新编辑器内容
</li>
<li>
<a href="multiDemo.html" target="_self">多编辑器实例</a><br/>
一个页面实例化多个编辑器,互不影响
</li>
<li>
<a href="renderInTable.html" target="_self">在表格中渲染编辑器</a><br/>
表格中渲染编辑器
</li>
<li>
<a href="jqueryCompleteDemo.html" target="_self">jquery</a><br/>
jquery中使用编辑器
</li>
<li>
<a href="jqueryValidation.html" target="_self">jqueryValidation</a><br/>
编辑器在jqueryValidation中验证
</li>
<li>
<a href="uparsedemo.html" target="_self">展示页面uparse.js解析</a><br/>
通过调用uparse.js在展示页面中自动解析编辑内容
</li>
<li>
<a href="filterRuleDemo.html" target="_self">过滤规则定制化</a><br/>
通过配置filterRules可以定制黑白名单过滤和转换你要的标签和属性
</li>
<li>
<a href="setWidthHeightDemo.html" target="_self">设置宽高</a><br/>
设置宽高的demo页面
</li>
<li>
<a href="multiEditorWithOneInstance.html" target="_self">多个编辑区使用一个编辑器实例</a><br/>
多个编辑区使用一个编辑器实例
</li>
</ul>
<script type="text/javascript">
var href = location.href;
if(href.indexOf("http") != 0 ){
alert("您当前尚未将UEditor部署到服务器环境部分浏览器下所有弹出框功能的使用会受到限制");
}
</script>
</body>
</html>

@ -0,0 +1,43 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>使用jquery的完整demo</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js" charset=""></script>
<script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<script>
$(function(){
var ue = UE.getEditor('myEditor');
$('#btn').click(function(){
//手动提交需要手动同步编辑器数据
ue.sync();
$('#form')[0].submit();
});
//--自动切换提交地址----
var version = ue.options.serverUrl || ue.options.imageUrl || "php",
form=$('#form')[0];
if(version.match(/php/)){
form.action="./server/getContent.php";
}else if(version.match(/net/)){
form.action="./server/getContent.ashx";
}else if(version.match(/jsp/)){
form.action="./server/getContent.jsp";
}else if(version.match(/asp/)){
form.action="./server/getContent.asp";
}
})
</script>
</head>
<body>
<form id="form" method="post" target="_blank">
<script type="text/plain" id="myEditor" name="myEditor">
<p>欢迎使用UEditor</p>
</script>
<input type="button" id="btn" value="提交数据">
</form>
</body>
</html>

@ -0,0 +1,63 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Ueditor在jquery validation下的验证</title>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.10.0/jquery.validate.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<script>
$(function(){
UE.getEditor('content');
var validator = $("#myform").submit(function() {
UE.getEditor('content').sync();
}).validate({
ignore: "",
rules: {
title: "required",
content: "required"
},
errorPlacement: function(label, element) {
label.insertAfter(element.is("textarea") ? element.next() : element);
}
});
validator.focusInvalid = function() {
if( this.settings.focusInvalid ) {
try {
var toFocus = $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []);
if (toFocus.is("textarea")) {
UE.getEditor('content').focus()
} else {
toFocus.filter(":visible").focus();
}
} catch(e) {
}
}
}
})
</script>
</head>
<body>
<form id="myform" action="">
<h3>Ueditor在jquery validation下的验证</h3>
<label>其他内容</label>
<input name="title" />
<br/>
<label>编辑器</label>
<textarea id="content" name="content" rows="15" cols="80" style="width: 80%"></textarea>
<br />
<input type="submit" name="save" value="Submit" />
</form>
</body>
</html>

@ -0,0 +1,43 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title></title>
<script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
</head>
<body>
<h1>UEditor多实例</h1>
<!--style给定宽度可以影响编辑器的最终宽度-->
<script type="text/plain" id="myEditor1" style="margin-bottom:100px;">
</script>
<script type="text/plain" id="myEditor2" style="margin-bottom:100px;">
<p>这里我可以写一些输入提示</p>
</script>
<script type="text/plain" id="myEditor3" style="margin-bottom:100px;">
</script>
<script type="text/javascript">
UE.getEditor('myEditor1', {
theme:"default", //皮肤
lang:'zh-cn' //语言
});
UE.getEditor('myEditor2', {
autoClearinitialContent:true, //focus时自动清空初始化时的内容
wordCount:false, //关闭字数统计
elementPathEnabled:false//关闭elementPath
});
UE.getEditor('myEditor3', {
//toolbars:[['FullScreen', 'Source', 'Undo', 'Redo','Bold']],//这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
lang:"en"
//更多其他参数请参考ueditor.config.js中的配置项
});
</script>
</body>
</html>

@ -0,0 +1,60 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title></title>
<script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js"></script>
<style>
table{margin-bottom:10px;border-collapse:collapse;display:table;border:1px dashed #ddd}
#test td{padding:5px;border: 1px solid #DDD;}
</style>
</head>
<body>
<h1>UEditor多编辑区域一个编辑器实例</h1>
<table id="test">
<tr>
<td width="10%">
编辑区域一
</td>
<td class="content" id="content1"><script id="editor1" type="text/plain" style="width:1024px;height:200px;">内容1</script></td>
</tr>
<tr>
<td>
编辑区域二
</td>
<td class="content" id="content2">内容2</td>
</tr>
<tr>
<td>
编辑区域三
</td>
<td class="content" id="content3">内容3</td>
</tr>
</table>
<script type="text/javascript">
var ue = UE.getEditor('editor1');
ue.ready(function(){
//阻止工具栏的点击向上冒泡
$(this.container).click(function(e){
e.stopPropagation()
})
});
$('.content').click(function(e){
var $target = $(this);
var content = $target.html();
var currentParnet = ue.container.parentNode.parentNode;
var currentContent = ue.getContent();
$target.html('');
$target.append(ue.container.parentNode);
ue.reset();
setTimeout(function(){
ue.setContent(content);
},200)
$(currentParnet).html(currentContent);
})
</script>
</body>
</html>

@ -0,0 +1,26 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<title>表格内实例化编辑器实例</title>
</head>
<body>
<div style="height: 100px"></div>
<div id="div" style="border: 1px solid #fff">
<table border="1">
<caption>表格标题</caption>
<tr><th>标题</th><th>内容</th></tr>
<!--编辑器实例化到表格内部时,请在对应的单元格上明确标注宽度值(百分数或者直接数均可),否则有可能在工具栏浮动等功能状态下出现移位-->
<tr>
<td>中国</td><td width="100%"><textarea id="editor"></textarea></td>
</tr>
</table>
</div>
<script type="text/javascript">
UE.getEditor('editor');
</script>
</body>
</html>

@ -0,0 +1,52 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>重置编辑器</title>
<script type="text/javascript" charset="utf-8" src="../ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<style type="text/css">
#simple {
width: 1000px;
border: 1px solid #ddd;
}
</style>
</head>
<body>
<h2>重置编辑器和销毁编辑器示例</h2>
<div class="content" id="simple"></div>
<p><input type="button" onclick="simple()" value="重置编辑器内部参数"><span id="txt"></span></p>
<p><input id="destroy" type="button" onclick="destroy()" value="销毁编辑器"></p>
<script type="text/javascript" charset="utf-8">
var editor = UE.getEditor('simple');
function simple() {
if(editor){
editor.setContent("编辑器内部变量已经被重置!");
editor.reset();
}
}
function destroy(){
editor.destroy();
editor = null;
clearInterval(timer);
var button = document.getElementById("destroy");
button.value = "重新渲染";
button.onclick = function(){
editor = UE.getEditor('simple');
this.value="销毁编辑器";
this.onclick = destroy;
timer = setInterval( setMsg, 100 );
}
}
function setMsg() {
if(editor && editor.undoManger){
document.getElementById( "txt" ).innerHTML = "编辑器当前保存了 <span style='color: red'> " + editor.undoManger.list.length + " </span>次操作";
}
}
var timer = setInterval( setMsg, 100 );
</script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save