整合营销服务商

电脑端+手机端+微信端=数据同步管理

免费咨询热线:

基于帝国CMS7.5版本编辑器代码高亮设置

基于帝国CMS7.5版本编辑器代码高亮设置

为发的技术文章多半含有代码,如果没有代码插件,那代码就显的太难看了,恰好ckeditor官方提供了高亮插件,这里记录一下如何实现。

一、下载插件及依赖工具

Code Snippet

widget

lineutils

widgetselection

二、将下载的插件解压,并复制到帝国的ckeditor目录下,注意是后台的那个

默认后台目录:e\admin\ecmseditor\infoeditor\plugins

三、修改配置文件

配置文件路径:e\admin\ecmseditor\infoeditor\config.js

配置文件中共有两个工具条,一个是全功能的,一个是精简的

在两个工具条中添加代码工具CodeSnippet

然后在工具条下方添加代码工具的配置

这里我把我的发上来供大家参考

CKEDITOR.editorConfig=function( config ) {
	// Define changes to default configuration here. For example:
	// config.language='fr';
	// config.uiColor='#AADC6E';
	
	config.filebrowserImageUploadUrl='';
	config.filebrowserFlashUploadUrl=arraycs[0];
	config.filebrowserImageBrowseUrl=arraycs[1];
	config.filebrowserFlashBrowseUrl=arraycs[1];
	
	config.enterMode=CKEDITOR.ENTER_BR;
	config.shiftEnterMode=CKEDITOR.ENTER_P;
	config.allowedContent=true;
	
	config.font_names='宋体/宋体;黑体/黑体;仿宋/仿宋_GB2312;楷体/楷体_GB2312;隶书/隶书;幼圆/幼圆;微软雅黑/微软雅黑;'+ config.font_names;
	
	// Toolbar
	config.toolbar_full=[
	{ name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source', '-', 'Preview', 'Print' ] },
	{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
	
	{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl' ] },
	'/',
	{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat', 'ecleanalltext', 'autoformat' ] },
	
	{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
	{ name: 'insert', items: [ 'Image', 'etranmore', 'Flash', 'etranmedia', 'etranfile', '-', 'Table', 'HorizontalRule', 'SpecialChar','CodeSnippet', 'equotetext', 'einserttime', 'einsertpage', 'einsertbr' ] },
	'/',
	{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
	{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
	{ name: 'tools', items: [ 'ShowBlocks', 'NewPage', 'Templates' ] },
	{ name: 'others', items: [ '-' ] },
	{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll', 'Maximize' ] }
];
	// Toolbar
	config.toolbar_basic=[
	{ name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source' ] },
	{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
	{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
	{ name: 'insert', items: [ 'Image', 'Table', 'HorizontalRule', 'SpecialChar','CodeSnippet' ] },
	{ name: 'tools', items: [ 'Maximize' ] },
	{ name: 'others', items: [ '-' ] },
	'/',
	{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Strike', '-', 'RemoveFormat' ] },
	{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote' ] },
	{ name: 'styles', items: [ 'Styles', 'Format' ] },
];
	config.extraPlugins='etranfile,etranmedia,etranmore,autoformat,ecleanalltext,einsertbr,einsertpage,einserttime,equotetext';
	config.extraPlugins='codesnippet';
	config.codeSnippet_theme='monokai_sublime';
	config.toolbar='full';
};

做完以上步骤,代码在后台是高亮的,但是在前台还不是高亮显示。现在需要我们做最后一步。

将gaoliang.css以及highlight.pack.js文件上传到网站服务器中,并在内容模板body前添加以下代码。

<link href="[!--news.url--]skin/jxhx/css/highlight.css" rel="stylesheet">
<script src="[!--news.url--]skin/jxhx/js/highlight.pack.js" ></script>
<script>hljs.initHighlightingOnLoad();</script>

其中skin/jxhx/css和skin/jxhx/js是我放置文件的路径,可以随意更改,路径正确就可以。

上述所有的插件可以通过链接跳转下载,css和js文件可以从我网站张扒下来,所有的文件我都进行了打包。

帝国CMS7.5版本编辑器代码高亮设置所有插件以及文件下载,提取码:pspl。

ngular9构建一个后台管理系统(二)

1. 前言

上一节中,我们学习了基本的环境搭建:nodeJs、npm、VSCode、AngularCli9的安装。

如果你顺利地都安装成功了,那么我们可以开始进行系统的构建和开发了,如果我们采用TypeScript,则我们还需要安装TypeScript支持。

本节内容中,我们会学会安装TypeScript,然后创建一个Angular工程,并尝试启动。

2. 安装TypeScript

1、使用如下命令安装:

npm install -g typescript

-g 参数代表着该模块是全局的。全局是相对于当前某个工程而言的。

2、安装完成后我们可以使用 tsc 命令来执行 TypeScript 的相关代码,以下是查看版本号:

tsc -v

3、我们可以测试一下TypeScript,建立一个app.ts 文件,内容如下。

var message:string="Hello World" 
console.log(message)

TypeScript脚本文件的扩展名即.ts

后执行以下命令将 TypeScript 转换为 JavaScript 代码:

tsc app.ts

执行完成,当前目录下(与 app.ts 同一目录)就会生成一个 app.js 文件,代码如下:

var message="Hello World";
console.log(message);

然后使用 node 命令来执行 app.js 文件,则会输出 Hello world:

D:\>node app.js 
Hello World

至此,TypeScript安装成功。

3. 创建Angular工程

1、我们利用AngularCli 可以方便的创建工程,仅仅需要一行命令:

ng new my-app

假设我们要在D盘,ECMS目录下建立我们的工程ecms-web,则启动CMD命令行,切换到D:\ECMS,然后输入我们的命令ng new ecms-web即可,也可以,在VSCode的终端中输入,由于要生成文件可能需要管理员权限运行命令行工具:

Microsoft Windows [版本 10.0.18363.836]
(c) 2019 Microsoft Corporation。保留所有权利。

C:\Windows\system32>d:

D:\>cd ECMS

D:\ECMS>dir
 驱动器 D 中的卷没有标签。
 卷的序列号是 9C30-21F8

 D:\ECMS 的目录

2021/03/12  14:40    <DIR>          .
2021/03/12  14:40    <DIR>          ..
               0 个文件              0 字节
               2 个目录 48,212,746,240 可用字节

D:\ECMS>ng new ecms-web
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS
CREATE ecms-web/angular.json (3582 bytes)
CREATE ecms-web/package.json (1252 bytes)
CREATE ecms-web/README.md (1025 bytes)
CREATE ecms-web/tsconfig.json (489 bytes)
CREATE ecms-web/tslint.json (3125 bytes)
CREATE ecms-web/.editorconfig (274 bytes)
CREATE ecms-web/.gitignore (631 bytes)
CREATE ecms-web/browserslist (429 bytes)
CREATE ecms-web/karma.conf.js (1020 bytes)
CREATE ecms-web/tsconfig.app.json (210 bytes)
CREATE ecms-web/tsconfig.spec.json (270 bytes)
CREATE ecms-web/src/favicon.ico (948 bytes)
CREATE ecms-web/src/index.html (293 bytes)
CREATE ecms-web/src/main.ts (372 bytes)
CREATE ecms-web/src/polyfills.ts (2835 bytes)
CREATE ecms-web/src/styles.css (80 bytes)
CREATE ecms-web/src/test.ts (753 bytes)
CREATE ecms-web/src/assets/.gitkeep (0 bytes)
CREATE ecms-web/src/environments/environment.prod.ts (51 bytes)
CREATE ecms-web/src/environments/environment.ts (662 bytes)
CREATE ecms-web/src/app/app-routing.module.ts (246 bytes)
CREATE ecms-web/src/app/app.module.ts (393 bytes)
CREATE ecms-web/src/app/app.component.html (25757 bytes)
CREATE ecms-web/src/app/app.component.spec.ts (1065 bytes)
CREATE ecms-web/src/app/app.component.ts (212 bytes)
CREATE ecms-web/src/app/app.component.css (0 bytes)
CREATE ecms-web/e2e/protractor.conf.js (808 bytes)
CREATE ecms-web/e2e/tsconfig.json (214 bytes)
CREATE ecms-web/e2e/src/app.e2e-spec.ts (641 bytes)
CREATE ecms-web/e2e/src/app.po.ts (301 bytes)
√ Packages installed successfully.
warning: LF will be replaced by CRLF in .editorconfig.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in .gitignore.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in README.md.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in angular.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in browserslist.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in e2e/protractor.conf.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in e2e/src/app.e2e-spec.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in e2e/src/app.po.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in e2e/tsconfig.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in karma.conf.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in package-lock.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in package.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/app/app-routing.module.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/app/app.component.html.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/app/app.component.spec.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/app/app.component.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/app/app.module.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/environments/environment.prod.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/environments/environment.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/index.html.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/main.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/polyfills.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/styles.css.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/test.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in tsconfig.app.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in tsconfig.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in tsconfig.spec.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in tslint.json.
The file will have its original line endings in your working directory
    Successfully initialized git.

D:\ECMS>

以上是整个过程。

在我们输入完命令,回车后,会有两个选项供我们选择:

would you like to add Angular routing?

我们输入y,回车。

? Which stylesheet format would you like to use?

直接回车,默认选择css。您也可以按上下箭头键,选择其他的css样式文件格式。

然后,AngularCli 会为我们创建一个基本的包含路由的Angular工程。

2、我们启动工程

我们进入刚刚创建的工程目录,然后执行如下命令:

ng serve

首次运行,会提示我们是否匿名分享数据,我们输入n,回车即可。

过程如下:

D:\ECMS>
D:\ECMS>cd ecms-web

D:\ECMS\ecms-web>dir

D:\ECMS\ecms-web 的目录

2021/03/12  14:44    <DIR>          .
2021/03/12  14:44    <DIR>          ..
2021/03/12  14:43               274 .editorconfig
2021/03/12  14:43               631 .gitignore
2021/03/12  15:00             3,623 angular.json
2021/03/12  14:43               429 browserslist
2021/03/12  14:43    <DIR>          e2e
2021/03/12  14:43             1,020 karma.conf.js
2021/03/12  14:44    <DIR>          node_modules
2021/03/12  14:44           536,685 package-lock.json
2021/03/12  14:43             1,252 package.json
2021/03/12  14:43             1,025 README.md
2021/03/12  14:43    <DIR>          src
2021/03/12  14:43               210 tsconfig.app.json
2021/03/12  14:43               489 tsconfig.json
2021/03/12  14:43               270 tsconfig.spec.json
2021/03/12  14:43             3,125 tslint.json
              12 个文件        549,033 字节
               5 个目录 47,722,569,728 可用字节

D:\ECMS\ecms-web>ng serve
Compiling @angular/core : es2015 as esm2015
Compiling @angular/animations : es2015 as esm2015
Compiling @angular/compiler/testing : es2015 as esm2015
Compiling @angular/common : es2015 as esm2015
Compiling @angular/animations/browser : es2015 as esm2015
Compiling @angular/core/testing : es2015 as esm2015
Compiling @angular/platform-browser : es2015 as esm2015
Compiling @angular/common/http : es2015 as esm2015
Compiling @angular/animations/browser/testing : es2015 as esm2015
Compiling @angular/common/testing : es2015 as esm2015
Compiling @angular/router : es2015 as esm2015
Compiling @angular/forms : es2015 as esm2015
Compiling @angular/platform-browser-dynamic : es2015 as esm2015
Compiling @angular/platform-browser/testing : es2015 as esm2015
Compiling @angular/platform-browser/animations : es2015 as esm2015
Compiling @angular/common/http/testing : es2015 as esm2015
Compiling @angular/platform-browser-dynamic/testing : es2015 as esm2015
Compiling @angular/router/testing : es2015 as esm2015

chunk {main} main.js, main.js.map (main) 60.6 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 141 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 12.4 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.01 MB [initial] [rendered]
Date: 2021-03-12T07:01:57.529Z - Hash: 2710539518a87a75e029 - Time: 7501ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
: Compiled successfully.

启动后,屏幕会提示如下内容:

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
: Compiled successfully.

此时我们打开浏览器输入http://localhost:4200/,即可查看默认的页面

我们可以看到网站的标题就是我们的工程名称:EcmsWeb。

至此我们的基本工程已经建立起来了。

如果ng serve 启动时提示端口已经被占用,我们使用如下命令指定端口启动:

ng serve --port 4201

4. 工程概览

我们看一下建立的工程目录结构

详细介绍如下:

首层目录:

  • node_modules 第三方依赖包存放目录
  • e2e 端到端的测试目录 用来做自动测试的
  • src 应用源代码目录
  • .angular-cli.json Angular命令行工具的配置文件。后期可能会去修改它,引一些其他的第三方的包 比如jquery等
  • karma.conf.js karma是单元测试的执行器,karma.conf.js是karma的配置文件
  • package.json 这是一个标准的npm工具的配置文件,这个文件里面列出了该应用程序所使用的第三方依赖包。实际上我们在新建项目的时候,等了半天就是在下载第三方依赖包。下载完成后会放在node_modules这个目录中,后期我们可能会修改这个文件。
  • protractor.conf.js 也是一个做自动化测试的配置文件
  • README.md 说明文件
  • tslint.json 是tslint的配置文件,用来定义TypeScript代码质量检查的规则,不用管它

src目录:

  • app目录 包含应用的组件和模块,我们要写的代码都在这个目录
  • assets目录 资源目录,存储静态资源的 比如图片
  • environments目录 环境配置。Angular是支持多环境开发的,我们可以在不同的环境下(开发环境,测试环境,生产环境)共用一套代码,主要用来配置环境的 index.html 整个应用的根html,程序启动就是访问这个页面
  • main.ts 整个项目的入口点,Angular通过这个文件来启动项目
  • polyfills.ts 主要是用来导入一些必要库,为了让Angular能正常运行在老版本下
  • styles.css 主要是放一些全局的样式
  • tsconfig.app.json TypeScript编译器的配置,添加第三方依赖的时候会修改这个文件 tsconfig.spec.json 不用管
  • test.ts 也是自动化测试用的
  • typings.d.ts 不用管

这些文件和目录,我们有个大概了解即可。随后的开发过程中,如果用到那个,我们再详细介绍。

5. 小结

本节教程,我们学习了安装TypeScript的安装以及验证,然后学习了如何建立一个Angular工程,以及如何启动和浏览工程。最后简单介绍了工程的目录结构情况。

收台达plc模块回收台达触摸屏 回收台达PLC模块台达变频器台达触摸屏 C2000 Plus、CH2000、MS300、MS300 IP66、ME300、VFD-E、VFD-EL、VFD-EL-W、CP2000、HES-C、MST、CSJ、MSI、AFE2000、REG2000、ASDA-A3、ASDA-B3、ASDA-A2、ASDA-A2-E、ASDA-B2、ASDA-M、ASDA-S、ECMS、ECML-S、ECML-S1606、ECML-S1608、ECML-S2003、ECML-S2004、ECML-S2005、ECML-S2504、ECML-S2506、ECML-S2508、ECML-S3204、ECML-S3206、ECML-S3208、ECML-S3505、ECML-S3506、ECML - SM16、ECML - SM20、ECML - SM25、ECML - SM32、ECML - SM35、ECM-PU381、ECM-PU382、ECM-PU383、ECM-PU384、DRVA1L7、DRS、DRS40L3、DRS60L6、DRS80LC、DRS30L3SS1BN002、DRS40L3SS1BN002、DRS60L3SS1BN002、DRS50L6SS1BN002、DRS60L6SS1BN002、DRS70L6SS1BN002、DRS60LCSS1BN002、DRS70LCSS1BN002、DRS80LCSS1BN002、DRS60H6SS1BN002、RS-AFS、RS-AFS60LA01、RS-AFS60LA02、D2V75W2BA、PMR-4V320WCAA、PMR-4V320WDAA、PMR-4V320WDGA、PMR-4V320WDBA、PMR-4V320WDCA、PMR-5V320WCAA、PMR-5V320WDAA、PMR-5V320WDGA、PMR-5V320WDBA、PMR-5V320WDCA、PJ、PJB、PJH、PJT、PJU、PJ-5V15WBNA、PJ-12V15WBNA、PJ-12V30WBNA、PJ-12V50WBNA、PJ-12V100WBNA、PJ-12V150WBNA、PJ-24V30WBNA、PJ-24V50WBNA、PJ-24V100WBNA、PJ-24V150WBNA、PJ-48V50WBNA、PJB-24V100WBNA、PJB-24V150WBNA、PJB-24V240WBNA、PJB-24V300WBNA、PJH-24V300WBBA、PJH-24V300WBCA、PJH-36V300WBBA、PJH-36V300WBCA、PJT-12V40WBAA、PJT-12V65WBAA、PJT-12V100WBAA、PJT-12V100WBBA、PJT-15V40WBAA、回收台达变频器回收台达plc回收台达驱动器回收台达伺服,回收台达伺服驱动器,伺服放大器,伺服电机,伺服马达,伺服定位模块回收台达伺服 收购台达驱动器 马达 电机,鞍山常年回收台达变频器,收购台达驱动器,回收台达plc,回收台达伺服等等台达电子元器件常年回收回收工控自动化气动产品,工厂拆机,设备淘汰,工程剩余货,流水线返修器件,闲置货全回收

交易方式:量大可上门现金交易,快递代收款,支付宝转账,转账

回收二手西门子要求;外观完好、物色好、外观没有明显划痕、功能正常、年份不限、数量不限、有多少要多少、

诚信交易、可上门交易、上门取货、交易地点、时间、由你选择、付款方式灵活、可快递代收、‘、、

支付宝、等等付款方式任你选择、有货的朋友还在等什么、赶快和我联系吧接头暗号:180-7436-8880(V电)同号