@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 工具类css
|
||||
*/
|
||||
/* 嵌套文字横线 */
|
||||
.line-container {
|
||||
width: 100%;
|
||||
background: url(../img/line.jpg) left center repeat-x;
|
||||
text-align: center;
|
||||
}
|
||||
.line {
|
||||
display: inline-block;
|
||||
padding: 0 10px;
|
||||
text-align: center;
|
||||
font-family: 'Microsoft Yahei';
|
||||
font-size: 24px;
|
||||
background: #fff;
|
||||
color: #000000;
|
||||
line-height: 1.3;
|
||||
}
|
||||
/**
|
||||
* 工具类css end
|
||||
*/
|
@ -0,0 +1,701 @@
|
||||
.container {
|
||||
margin: 0 auto;
|
||||
width: 980px;
|
||||
}
|
||||
|
||||
label {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* 导航栏 */
|
||||
.nav {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.layui-nav * {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
/* 轮播图 */
|
||||
.swiper-item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.layui-carousel-ind li {
|
||||
width: 80px;
|
||||
height: 5px;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
/* 商品推荐标题 */
|
||||
.recommend-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.index-title {
|
||||
margin: 0 auto;
|
||||
width: 980px;
|
||||
text-align: center;
|
||||
font-size: 42px;
|
||||
font-family: "Times New Roman", Times, serif;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.recommend-list {
|
||||
width: 1000px;
|
||||
margin: 0 auto;
|
||||
height: 360px;
|
||||
padding: 0px 0 0 0;
|
||||
}
|
||||
|
||||
.recommend-item {
|
||||
float: left;
|
||||
width: 1000px;
|
||||
padding: 20px 0 0 0;
|
||||
}
|
||||
|
||||
.recommend-item li {
|
||||
float: left;
|
||||
width: 218px;
|
||||
position: relative;
|
||||
display: inline;
|
||||
margin: 0 15px;
|
||||
}
|
||||
|
||||
.recommend-item li a.img {
|
||||
float: left;
|
||||
width: 218px;
|
||||
height: 218px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background: url(../img/yuan.png) left top no-repeat;
|
||||
}
|
||||
|
||||
.recommend-item li a.wor {
|
||||
float: left;
|
||||
width: 218px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
display: inline;
|
||||
margin: 10px 0 0 0;
|
||||
}
|
||||
|
||||
/* 首页新闻样式(手风琴) */
|
||||
.news-home-container {
|
||||
padding-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.news-home-container .layui-collapse {
|
||||
border: 0;
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
.news-home-container .layui-colla-item {
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.news-home-container .layui-colla-content {
|
||||
font-size: 16px;
|
||||
line-height: 40px;
|
||||
height: 115px;
|
||||
}
|
||||
|
||||
.news-home-container .layui-colla-title {
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.news-home-container .card-container {
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.news-home-container .layui-card-header {
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
}
|
||||
|
||||
/* 底部导航 */
|
||||
.nav-bottom {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 底部栏 */
|
||||
.footer {
|
||||
margin: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.footer-item {
|
||||
color: #515151;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/* 留言 */
|
||||
.message-container {
|
||||
width: 980px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.message-container .message-form {
|
||||
margin-top: 20px;
|
||||
border-bottom: 1px dotted #888888;
|
||||
}
|
||||
|
||||
.message-container .message-list {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
||||
.message-container .message-list .message-item {
|
||||
margin-top: 20px;
|
||||
border-bottom: 1px solid #EEEEEE;
|
||||
}
|
||||
|
||||
.message-container .message-list .message-item .username-container {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.message-container .message-list .message-item .username-container .avator {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.message-container .message-list .message-item .content {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.message-container .message-list .message-item .replay {
|
||||
background: #EEEEEE;
|
||||
margin: 10px;
|
||||
padding: 20px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
/* 论坛 */
|
||||
.forum-container {
|
||||
width: 980px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.forum-container .forum-list {
|
||||
text-align: left;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.forum-container .forum-list .forum-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
border-bottom: 3px dotted #EEEEEE;
|
||||
border-top: 3px dotted #EEEEEE;
|
||||
}
|
||||
|
||||
.forum-container .forum-list .forum-item.line {
|
||||
background: #EEEEEE;
|
||||
}
|
||||
|
||||
|
||||
.forum-container .forum-list .forum-item .h2 {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.forum-container .forum-list .forum-item .create-time {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.forum-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.forum-container .title {
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.forum-container .content {
|
||||
width: 980px;
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
margin-top: 30px;
|
||||
font-size: 16px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.forum-container .auth-container {
|
||||
margin-top: 20px;
|
||||
color: #888888;
|
||||
border-bottom: 1px dotted #888888;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.forum-container .bottom-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 980px;
|
||||
margin: 0 auto;
|
||||
background: #EEEEEE;
|
||||
height: 60px;
|
||||
line-height: 60px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.forum-container .bottom-container .title {
|
||||
margin-left: 30px;
|
||||
font-size: 20px;
|
||||
color: #515151;
|
||||
}
|
||||
|
||||
.forum-container .bottom-container .btn {
|
||||
font-size: 20px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.forum-container .message-list {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
||||
.forum-container .message-list .message-item {
|
||||
margin-top: 20px;
|
||||
border-bottom: 1px solid #EEEEEE;
|
||||
}
|
||||
|
||||
.forum-container .message-list .message-item .username-container {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.forum-container .message-list .message-item .username-container .avator {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.forum-container .message-list .message-item .content {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.forum-container .message-list .message-item .replay {
|
||||
background: #EEEEEE;
|
||||
margin: 10px;
|
||||
padding: 20px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
/* 考试 */
|
||||
.paper-container {
|
||||
width: 980px;
|
||||
margin: 0 auto;
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.paper-container thead {
|
||||
border-radius: 100px;
|
||||
}
|
||||
|
||||
.paper-container thead tr th {
|
||||
font-size: 16px;
|
||||
font-weight: blod;
|
||||
line-height: 50px;
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.paper-container tbody tr td {
|
||||
font-size: 16px;
|
||||
height: 50px;
|
||||
border-bottom: 5px dotted #EEEEEE;
|
||||
}
|
||||
|
||||
.paper-container tbody tr {
|
||||
border: 3px dotted #EEEEEE;
|
||||
}
|
||||
|
||||
/* 个人中心 */
|
||||
.center-container {
|
||||
width: 980px;
|
||||
margin: 0 auto;
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.center-container .left-container {
|
||||
border: 2px dotted #EEEEEE;
|
||||
background: #FFFFFF;
|
||||
width: 200px;
|
||||
padding-top: 20px;
|
||||
height: 600px;
|
||||
}
|
||||
|
||||
.center-container .right-container {
|
||||
flex: 1;
|
||||
border: 2px dotted #EEEEEE;
|
||||
background: #FFFFFF;
|
||||
text-align: left;
|
||||
padding: 20px;
|
||||
padding-top: 40px;
|
||||
}
|
||||
|
||||
/* 购物车 */
|
||||
.btn-container {
|
||||
margin-top: 20px;
|
||||
text-align: right;
|
||||
margin-bottom: 60px;
|
||||
border: 2px dotted #EEEEEE;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* 登陆注册 */
|
||||
.login-container {
|
||||
background: #FFFFFF;
|
||||
z-index: 9;
|
||||
position: relative;
|
||||
width: 480px;
|
||||
margin: 0 auto;
|
||||
border-radius: 20px;
|
||||
margin-top: 100px;
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.login-bg {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0.8;
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.login-container .bottom-container {
|
||||
text-align: center;
|
||||
color: #888888;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.login-container .bottom-container a {
|
||||
margin-left: 10px;
|
||||
border: 2px dotted #888888;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* 确认下单页面 */
|
||||
.address-table {
|
||||
border: 3px dotted #EEEEEE;
|
||||
}
|
||||
|
||||
/* 图文列表 */
|
||||
.data-container {
|
||||
margin: 20px 0;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.data-container .data-list .data-item {
|
||||
padding: 20px;
|
||||
text-align: left;
|
||||
margin-bottom: 10px;
|
||||
min-height: 330px;
|
||||
}
|
||||
|
||||
.data-container .data-list .data-item:hover {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
|
||||
.data-container .data-list .data-item .cover {
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
object-fit: cover;
|
||||
border: 1px solid #EEEEEE;
|
||||
}
|
||||
|
||||
.data-container .data-list .data-item .title {
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.data-container .data-list .data-item .price {
|
||||
font-size: 20px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.data-container .data-list .data-item .data {
|
||||
font-size: 16px;
|
||||
border: 1px solid #EEEEEE;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.data-container .data-list .data-item .data .item {
|
||||
width: 40%;
|
||||
text-align: center;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.search-container {
|
||||
border: 0;
|
||||
font-size: 16px;
|
||||
width: 980px;
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* 数据详情页 */
|
||||
|
||||
.data-detail {
|
||||
width: 980px;
|
||||
margin: 0 auto;
|
||||
margin-top: 20px;
|
||||
text-align: left;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.data-detail-breadcrumb {
|
||||
margin: 10px 0;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.data-detail .title {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
border: 3px dotted #EEEEEE;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.data-detail .count-container {
|
||||
background: url(../img/seckilling.jpg);
|
||||
margin-top: 20px;
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.data-detail .count-container .text {
|
||||
font-size: 18px;
|
||||
font-weight: blod;
|
||||
}
|
||||
|
||||
.data-detail .count-container .number {
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
font-weight: blod;
|
||||
}
|
||||
|
||||
.data-detail .tool-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
font-size: 16px;
|
||||
font-weight: bolder;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.data-detail .price {
|
||||
color: red;
|
||||
font-size: 16px;
|
||||
font-weight: bolder;
|
||||
font-size: 20px;
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.data-detail .detail-item {
|
||||
background: #EEEEEE;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.data-detail .desc {
|
||||
font-size: 16px;
|
||||
color: #515151;
|
||||
}
|
||||
|
||||
.video-container {
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.num-picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.num-picker button {
|
||||
border: 0;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.num-picker input {
|
||||
width: 50px;
|
||||
text-align: center;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.data-add-container{
|
||||
width: 800px;
|
||||
margin: 0 auto;
|
||||
margin-top: 20px;
|
||||
text-align: left;
|
||||
margin-bottom: 20px;
|
||||
background: #FFFFFF;
|
||||
padding: 20px;
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
/* 详情页选座 */
|
||||
.seat-list {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
background: #FFFFFF;
|
||||
margin: 20px;
|
||||
border-radius: 20px;
|
||||
padding: 20px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.seat-item {
|
||||
width: 10%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.seat-icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* banner */
|
||||
.banner {
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
/* 新闻列表 */
|
||||
.news-container {
|
||||
text-align: center;
|
||||
margin: 0 auto;
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
.news-container .pager {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.news-container .news-list {
|
||||
width: 980px;
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.news-container .news-list .news-item {
|
||||
display: flex;
|
||||
border-bottom: 1px solid #EEEEEE;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.news-container .news-list .news-item .cover-container {
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
.news-container .news-list .news-item .cover-container .cover {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.news-container .news-list .news-item .detail-container .h2 {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.news-container .news-list .news-item .detail-container .desc {
|
||||
height: 140px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.news-container .title {
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.news-container .content {
|
||||
width: 980px;
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
margin-top: 30px;
|
||||
font-size: 16px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.news-container .auth-container {
|
||||
margin-top: 20px;
|
||||
color: #888888;
|
||||
border-bottom: 1px dotted #888888;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
|
||||
.news-container .bottom-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 980px;
|
||||
margin: 0 auto;
|
||||
background: #EEEEEE;
|
||||
height: 60px;
|
||||
line-height: 60px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.news-container .bottom-container .title {
|
||||
margin-left: 30px;
|
||||
font-size: 20px;
|
||||
color: #515151;
|
||||
}
|
||||
|
||||
.news-container .bottom-container .btn {
|
||||
font-size: 20px;
|
||||
padding: 0 20px;
|
||||
}
|
@ -0,0 +1,265 @@
|
||||
/* 导航栏 */
|
||||
.nav {
|
||||
background: #f7f7f7;
|
||||
}
|
||||
|
||||
.layui-nav .layui-nav-item a {
|
||||
color: #515151;
|
||||
}
|
||||
|
||||
.layui-nav .layui-this:after,
|
||||
.layui-nav-bar,
|
||||
.layui-nav-tree .layui-nav-itemed:after {
|
||||
background-color: #ce0b07;
|
||||
}
|
||||
|
||||
.layui-nav .layui-nav-item a:hover {
|
||||
color: #FFFFFF;
|
||||
background-color: #ce0b07;
|
||||
}
|
||||
|
||||
.layui-nav .layui-nav-child dd.layui-this a,
|
||||
.layui-nav-child dd.layui-this {
|
||||
background-color: #ce0b07;
|
||||
}
|
||||
|
||||
.layui-nav-tree .layui-nav-child dd.layui-this, .layui-nav-tree .layui-nav-child dd.layui-this a, .layui-nav-tree .layui-this, .layui-nav-tree .layui-this>a, .layui-nav-tree .layui-this>a:hover {
|
||||
background-color: #ce0b07;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* 轮播图 */
|
||||
.layui-carousel[lay-indicator=outside] .layui-carousel-ind ul {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.layui-carousel-ind li.layui-this {
|
||||
background-color: #ce0b07;
|
||||
}
|
||||
|
||||
.layui-carousel-ind li {
|
||||
background-color: #888888;
|
||||
}
|
||||
|
||||
/* 首页标题 */
|
||||
.index-title {
|
||||
color: #ce0b07;
|
||||
}
|
||||
|
||||
/* 首页新闻 */
|
||||
.news-home-container {
|
||||
background: #e5e5e5;
|
||||
}
|
||||
|
||||
.news-home-container .layui-colla-item {
|
||||
border: 1px solid #EEEEEE;
|
||||
}
|
||||
|
||||
.news-home-container .layui-colla-content {
|
||||
background: #FFFFFF;
|
||||
}
|
||||
|
||||
.news-home-container .layui-colla-title {
|
||||
background: #d1d1d1;
|
||||
border: 1px solid #EEEEEE;
|
||||
color: #515151;
|
||||
}
|
||||
|
||||
.news-home-container .layui-colla-title:hover {
|
||||
background: #ce0b07;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.news-home-container .layui-card-header {
|
||||
background: #d1d1d1;
|
||||
border: 1px solid #FFFFFF;
|
||||
color: #515151;
|
||||
}
|
||||
|
||||
/* 图文列表 */
|
||||
|
||||
.data-container .data-list .data-item:hover {
|
||||
border: 1px solid #ce0b07;
|
||||
}
|
||||
|
||||
|
||||
.data-container .data-list .data-item .title:hover {
|
||||
background: #ce0b07;
|
||||
}
|
||||
|
||||
|
||||
.data-container .data-list .data-item .title {
|
||||
background: #515151;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.data-container .data-list .data-item .price {
|
||||
color: #ce0b07;
|
||||
}
|
||||
|
||||
/* 详情页 */
|
||||
.data-detail {
|
||||
background: #FFFFFF;
|
||||
}
|
||||
|
||||
.data-detail-breadcrumb {
|
||||
background: #EEEEEE;
|
||||
color: #515151;
|
||||
}
|
||||
|
||||
.data-detail .title {
|
||||
color: #515151;
|
||||
border: 3px dotted #EEEEEE;
|
||||
}
|
||||
|
||||
.data-detail .count-container {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.data-detail .count-container .number {
|
||||
background: #443b3b;
|
||||
}
|
||||
|
||||
.data-detail .tool-container{
|
||||
border: 3px dotted #EEEEEE;
|
||||
}
|
||||
|
||||
.data-detail .price{
|
||||
color: #ce0b07;
|
||||
}
|
||||
|
||||
|
||||
.layui-tab-card>.layui-tab-title .layui-this {
|
||||
background-color: #ce0b07;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
/* 底部导航栏 */
|
||||
.nav-bottom {
|
||||
background: #ce0b07;
|
||||
}
|
||||
|
||||
.nav-bottom .layui-nav-item a {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
/* banner */
|
||||
.banner {
|
||||
background: #ce0b07;
|
||||
}
|
||||
|
||||
/* 新闻资讯 */
|
||||
.news-container .news-list .news-item .detail-container .h2 {
|
||||
color: #4e6990;
|
||||
}
|
||||
|
||||
.news-container .news-list .news-item .detail-container .desc {
|
||||
color: #515151;
|
||||
}
|
||||
|
||||
.news-container .news-list .news-item .detail-container .create-time {
|
||||
color: #515151;
|
||||
}
|
||||
|
||||
.news-container .title {
|
||||
color: #ce0b07;
|
||||
}
|
||||
|
||||
|
||||
.news-container .bottom-container .btn {
|
||||
background: #ce0b07;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
/* 论坛 */
|
||||
|
||||
.forum-container .bottom-container .btn {
|
||||
background: #ce0b07;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.forum-container .forum-list .forum-item:hover {
|
||||
background: #ce0b07;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.forum-container .forum-list .forum-item.line:hover {
|
||||
background: #ce0b07;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
/* 考试 */
|
||||
.paper-container thead tr{
|
||||
background: #ce0b07 ;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.paper-container tbody tr:hover{
|
||||
color: #FFFFFF;
|
||||
background-color: #ce0b07;
|
||||
}
|
||||
|
||||
/* 个人中心 */
|
||||
|
||||
.center-container .layui-nav .layui-nav-more {
|
||||
border-color: #515151 transparent transparent;
|
||||
}
|
||||
|
||||
.center-container .layui-nav-itemed>a, .layui-nav-tree .layui-nav-title a, .layui-nav-tree .layui-nav-title a:hover {
|
||||
color: #515151 !important;
|
||||
}
|
||||
|
||||
.center-container .layui-nav .layui-nav-mored, .layui-nav-itemed>a .layui-nav-more {
|
||||
border-color: transparent transparent #515151;
|
||||
}
|
||||
|
||||
.center-container .layui-nav {
|
||||
background-color: #FFFFFF;
|
||||
color: #515151;
|
||||
}
|
||||
|
||||
.center-container .layui-nav-itemed>.layui-nav-child {
|
||||
background-color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.center-container .layui-nav-tree .layui-nav-bar {
|
||||
width: 5px;
|
||||
height: 0;
|
||||
background-color: #ce0b07;
|
||||
}
|
||||
|
||||
/* 分页插件 */
|
||||
.layui-laypage .layui-laypage-curr .layui-laypage-em {
|
||||
background-color: #ce0b07;
|
||||
}
|
||||
|
||||
.layui-laypage a:hover {
|
||||
color: #ce0b07;
|
||||
}
|
||||
|
||||
.btn-submit {
|
||||
background: #ce0b07;
|
||||
}
|
||||
|
||||
.btn-theme{
|
||||
background: #ce0b07;
|
||||
}
|
||||
|
||||
|
||||
/* checkbox */
|
||||
.layui-form-radio>i:hover, .layui-form-radioed>i {
|
||||
color: #ce0b07;
|
||||
}
|
||||
|
||||
.layui-form-select dl dd.layui-this {
|
||||
background-color: #ce0b07;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.layui-tab-brief>.layui-tab-title .layui-this {
|
||||
color: #ce0b07;
|
||||
}
|
||||
|
||||
.layui-tab-brief>.layui-tab-more li.layui-this:after, .layui-tab-brief>.layui-tab-title .layui-this:after {
|
||||
border-bottom: 2px solid #ce0b07;
|
||||
}
|
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 4.7 KiB |
@ -0,0 +1,303 @@
|
||||
<!-- 首页 -->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>赛界智慧管家——沉浸式报名体验开拓者</title>
|
||||
<link rel="stylesheet" href="./layui/css/layui.css">
|
||||
<link rel="stylesheet" href="./xznstatic/css/common.css"/>
|
||||
<link rel="stylesheet" href="./xznstatic/css/style.css"/>
|
||||
</head>
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
height: 100%;
|
||||
}
|
||||
#iframe {
|
||||
width: 100%;
|
||||
margin-top: 100px;
|
||||
padding-top: 60px;
|
||||
}
|
||||
#header {
|
||||
height: auto;
|
||||
background: #fff;
|
||||
border-bottom: 0;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#header .nav-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
font-size: 16px;
|
||||
color: #2a8a15;
|
||||
box-sizing: border-box;
|
||||
height: 100px;
|
||||
background-color: rgb(8, 108, 155);
|
||||
box-shadow: ;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#header .nav-top-img {
|
||||
width: 124px;
|
||||
height: 40px;
|
||||
padding: 0;
|
||||
margin: 0 400px 0 300px;
|
||||
border-radius: 6px;
|
||||
border-width: 0;
|
||||
border-style: solid;
|
||||
border-color: rgba(0,0,0,.3);
|
||||
box-shadow: 0 0 6px rgba(0,0,0,.3);
|
||||
}
|
||||
|
||||
#header .nav-top-title {
|
||||
line-height: 60px;
|
||||
font-size: 25px;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
padding: ;
|
||||
margin: ;
|
||||
border-radius: ;
|
||||
border-width: ;
|
||||
border-style: ;
|
||||
border-color: rgba(31, 4, 4, 1);
|
||||
box-shadow: ;
|
||||
}
|
||||
|
||||
#header .nav-top-tel {
|
||||
line-height: 40px;
|
||||
font-size: 20px;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
padding: 0 10px;
|
||||
margin: 0;
|
||||
border-radius: 6px;
|
||||
border-width: 0;
|
||||
border-style: ;
|
||||
border-color: rgba(10, 0, 0, 0.99);
|
||||
box-shadow: 0px;
|
||||
}
|
||||
|
||||
#header .navs {
|
||||
display: flex;
|
||||
padding: 0 20px;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
height: 60px;
|
||||
background-color: rgb(255, 255, 255);
|
||||
box-shadow: ;
|
||||
justify-content: center;
|
||||
}
|
||||
#header .navs .title {
|
||||
width: auto;
|
||||
line-height: 40px;
|
||||
font-size: 16px;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
padding: 0 10px;
|
||||
margin: 0 5px;
|
||||
border-radius: ;
|
||||
border-width: 1;
|
||||
border-style: ;
|
||||
border-color: rgba(0, 0, 0, 0.97);
|
||||
box-shadow: ;
|
||||
}
|
||||
#header .navs li {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
line-height: 40px;
|
||||
padding: 10px 25px;
|
||||
margin: 0px 1px;
|
||||
color: rgb(10, 10, 10);
|
||||
font-size: 16px;
|
||||
border-radius: 0px;
|
||||
border-width: 1;
|
||||
border-style: ;
|
||||
border-color: rgba(0, 0, 0, 1);
|
||||
background-color: $template2.front.base.nav.list.item.backgroundColor;
|
||||
box-shadow: ;
|
||||
text-align: center;
|
||||
}
|
||||
#header .navs li a{
|
||||
color: inherit;
|
||||
}
|
||||
#header .navs li.current a{
|
||||
color: inherit;
|
||||
}
|
||||
#header .navs li a:hover{
|
||||
color: inherit;
|
||||
}
|
||||
#header .navs li.current {
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 16px;
|
||||
border-radius: 0xp;
|
||||
border-width: ;
|
||||
border-style: ;
|
||||
border-color: rgba(0,0,0,.3);
|
||||
background-color: rgb(8, 108, 155);
|
||||
box-shadow: ;
|
||||
}
|
||||
#header .navs li:hover {
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 16px;
|
||||
border-radius: 0px;
|
||||
border-width: 0;
|
||||
border-style: solid;
|
||||
border-color: rgba(0, 0, 0, 0.98);
|
||||
background-color: rgb(8, 108, 155);
|
||||
box-shadow: ;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<!-- start 顶部导航栏 -->
|
||||
<div id="header">
|
||||
<div v-if='true' class="nav-top">
|
||||
<img v-if='false' class="nav-top-img" src=''>
|
||||
<div v-if="true" class="nav-top-title">赛界智慧管家——沉浸式报名体验开拓者</div>
|
||||
<div class="nav-top-tel">赛界——赛无边界</div>
|
||||
</div>
|
||||
<div class="navs">
|
||||
<!-- <div class="logo" style="font-size: 20px;top: 32px;color: #fff;font-weight: bold;margin-left: -200px;width: 240px;" v-text="projectName"></div> -->
|
||||
<div class="title" v-if="false" v-text="projectName"></div>
|
||||
<div class="list">
|
||||
<ul>
|
||||
<li class='current'><a href="javascript:navPage('./pages/home/home.html')" class="menumain"><i v-if="false" class="layui-icon layui-icon-home"></i>首页</a></li>
|
||||
<li v-for="(item,index) in indexNav" v-bind:key="index"><a :href="' javascript:navPage(\''+item.url+'\')'" class="menumain" style="cursor: pointer;"><i v-if="false" class="layui-icon" :class="iconArr[index]"></i>{{item.name}}</a></li>
|
||||
<li><a href="javascript:centerPage();" class="menumain"><i v-if="false" class="layui-icon layui-icon-username"></i>后台管理</a></li>
|
||||
<li><a :href="adminurl" target="_blank" class="menumain" style="cursor: pointer;"><i v-if="false" class="layui-icon layui-icon-link"></i>个人中心</a></li>
|
||||
<li v-if="cartFlag"><a href="javascript:navPage('./pages/shop-cart/list.html')" class="menumain"><i v-if="false" class="layui-icon"></i>1</a></li>
|
||||
<li v-if="chatFlag"><a href="javascript:chatTap()" class="menumain"><i v-if="false" class="layui-icon"></i>1</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end 顶部导航栏 -->
|
||||
|
||||
<iframe src="./pages/home/home.html" id="iframe" frameborder="0" scrolling="no" width="100%" onload="changeFrameHeight"></iframe>
|
||||
|
||||
<div id="tabbar" v-if="true" class="tabbar" :style='{"padding":"20px 0","boxShadow":"0 0 6px rgba(1,0,0,.5)","margin":"10px 0 0 0","borderColor":"rgba(14, 0, 0, 0.3)","backgroundColor":"rgba(118, 67, 6, 1)","borderRadius":"0","borderWidth":"0","borderStyle":"solid"}' style="position: relative;z-index: 999;">
|
||||
<img v-if='false' :style='{"boxShadow":"0 0 6px rgba(255,0,0,.8)","margin":"0 auto","borderColor":"rgba(0,0,0,.3)","borderRadius":"100%","borderWidth":"1px","width":"44px","borderStyle":"solid","height":"44px"}' style='display: block;' src='http://codegen.caihongy.cn/20201024/ed5e326ca66f403aa3197b5fbb4ec733.jpg' />
|
||||
<div :style='{"padding":"0 10px","boxShadow":"","margin":"10px auto","borderColor":"rgba(0,0,0,1)","backgroundColor":"rgba(245, 228, 131, 1)","color":"rgba(10, 10, 10, 0.99)","textAlign":"center","borderRadius":"0","borderWidth":"0","width":"100%","lineHeight":"32px","fontSize":"14px","borderStyle":"solid"}' class="company"></div>
|
||||
<div :style='{"padding":"0 10px","boxShadow":"","margin":"10px auto","borderColor":"rgba(0,0,0,1)","backgroundColor":"rgba(245, 229, 137, 1)","color":"rgba(4, 4, 4, 1)","textAlign":"center","borderRadius":"0","borderWidth":"0","width":"100%","lineHeight":"32px","fontSize":"14px","borderStyle":"solid"}' class="record"></div>
|
||||
<div :style='{"padding":"0 10px","boxShadow":"","margin":"10px auto 30px auto","borderColor":"rgba(255,255,255,1)","backgroundColor":"rgba(118, 67, 6, 1)","color":"rgba(255, 255, 255, 1)","textAlign":"center","borderRadius":"0","borderWidth":"1px 0","width":"40%","lineHeight":"32px","fontSize":"14px","borderStyle":""}' class="desc">五个勤天</div>
|
||||
</div>
|
||||
|
||||
<script src="./xznstatic/js/jquery-1.11.3.min.js"></script>
|
||||
<script src="./layui/layui.js"></script>
|
||||
<script src="./js/vue.js"></script>
|
||||
<script src="./js/config.js"></script>
|
||||
|
||||
<script>
|
||||
var vue1 = new Vue({el: '#tabbar'})
|
||||
|
||||
var vue = new Vue({
|
||||
el: '#header',
|
||||
data: {
|
||||
iconArr: ['layui-icon-gift','layui-icon-email','layui-icon-logout','layui-icon-transfer','layui-icon-slider','layui-icon-print','layui-icon-cols','layui-icon-snowflake','layui-icon-note','layui-icon-flag','layui-icon-theme','layui-icon-website','layui-icon-console','layui-icon-face-surprised','layui-icon-template-1','layui-icon-app','layui-icon-read','layui-icon-component','layui-icon-file-b','layui-icon-unlink','layui-icon-tabs','layui-icon-form','layui-icon-chat'],
|
||||
indexNav: indexNav,
|
||||
cartFlag: cartFlag,
|
||||
adminurl: adminurl,
|
||||
chatFlag: chatFlag,
|
||||
projectName: projectName,
|
||||
},
|
||||
mounted: function() {
|
||||
this.bindClickOnLi();
|
||||
},
|
||||
created() {
|
||||
this.iconArr.sort(()=>{
|
||||
return (0.5-Math.random())
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
jump(url) {
|
||||
jump(url)
|
||||
},
|
||||
bindClickOnLi() {
|
||||
let list = document.getElementsByTagName("li");
|
||||
for(var i = 0;i<list.length;i++){
|
||||
list[i].onclick = function(){
|
||||
$(this).addClass("current").siblings().removeClass("current");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
layui.use(['element','layer'], function() {
|
||||
var element = layui.element;
|
||||
var layer = layui.layer;
|
||||
});
|
||||
|
||||
function chatTap(){
|
||||
var userTable = localStorage.getItem('userTable');
|
||||
if (userTable) {
|
||||
layui.layer.open({
|
||||
type: 2,
|
||||
title: '客服',
|
||||
area: ['600px', '600px'],
|
||||
content: './pages/chat/chat.html'
|
||||
});
|
||||
} else {
|
||||
window.location.href = './pages/login/login.html'
|
||||
}
|
||||
}
|
||||
|
||||
// 导航栏跳转
|
||||
function navPage(url) {
|
||||
localStorage.setItem('iframeUrl', url);
|
||||
document.getElementById('iframe').src = url;
|
||||
}
|
||||
|
||||
// 跳转到个人中心也
|
||||
function centerPage() {
|
||||
var userTable = localStorage.getItem('userTable');
|
||||
if (userTable) {
|
||||
localStorage.setItem('iframeUrl', './pages/' + userTable + '/center.html');
|
||||
document.getElementById('iframe').src = './pages/' + userTable + '/center.html';
|
||||
} else {
|
||||
window.location.href = './pages/login/login.html'
|
||||
}
|
||||
}
|
||||
|
||||
var iframeUrl = localStorage.getItem('iframeUrl');
|
||||
document.getElementById('iframe').src = iframeUrl || './pages/home/home.html';
|
||||
|
||||
// var i = 0;
|
||||
setInterval(function(){
|
||||
// i++;
|
||||
// if(i<50) changeFrameHeight();
|
||||
changeFrameHeight();
|
||||
},200)
|
||||
|
||||
function changeFrameHeight() {
|
||||
var iframe = document.getElementById('iframe');
|
||||
// iframe.height = 'auto';
|
||||
if (iframe) {
|
||||
var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
|
||||
if (iframeWin.document.body) {
|
||||
iframe.height = iframeWin.document.body.scrollHeight;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 窗口变化时候iframe自适应
|
||||
// function changeFrameHeight() {
|
||||
// var header = document.getElementById('header').scrollHeight;
|
||||
// let isshow = true
|
||||
// var tabbar = 0
|
||||
// if(isshow) {
|
||||
// tabbar = document.getElementById('tabbar').scrollHeight
|
||||
// }
|
||||
// var ifm = document.getElementById("iframe");
|
||||
// ifm.height = document.documentElement.clientHeight - header - tabbar;
|
||||
// ifm.width = document.documentElement.clientWidth;
|
||||
// }
|
||||
|
||||
// reasize 事件 窗口大小变化后执行的方法
|
||||
window.onresize = function() {
|
||||
changeFrameHeight();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,121 @@
|
||||
<!-- 首页 -->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>首页</title>
|
||||
<link rel="stylesheet" href="./layui/css/layui.css">
|
||||
<link rel="stylesheet" href="./xznstatic/css/common.css"/>
|
||||
<link rel="stylesheet" href="./xznstatic/css/style.css"/>
|
||||
</head>
|
||||
<body scrolling="no" style="overflow-y: hidden;overflow-x: hidden;">
|
||||
<!-- start 顶部导航栏 -->
|
||||
<div id="header">
|
||||
<div class="top">
|
||||
<div class="logo" style="font-size: 20px;top: 32px;color: #fff;font-weight: bold;margin-left: -200px;width: 240px;" v-text="projectName"></div>
|
||||
<div class="nav">
|
||||
<ul>
|
||||
<li class='current'><a href="javascript:navPage('./pages/home/home.html')" class="menumain">首页</a></li>
|
||||
<li v-for="(item,index) in indexNav" v-bind:key="index"><a :href="'javascript:navPage(\''+item.url+'\')'" class="menumain" style="cursor: pointer;">{{item.name}}</a></li>
|
||||
<li><a href="javascript:centerPage();" class="menumain">我的</a></li>
|
||||
<li><a :href="'javascript:window.location.href=\''+adminurl+'\''" target="_blank" class="menumain" style="cursor: pointer;">跳转到后台</a></li>
|
||||
<li v-if="cartFlag"><a href="javascript:navPage('./pages/cart/list.html')" class="menumain"><i class="layui-icon" style="font-size: 24px;"></i>购物车</a></li>
|
||||
<li v-if="chatFlag"><a href="javascript:chatTap()" class="menumain"><i class="layui-icon" style="font-size: 24px;"></i>客服</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end 顶部导航栏 -->
|
||||
|
||||
<iframe src="./pages/home/home.html" id="iframe" frameborder="0" scrolling="auto" onload="changeFrameHeight()"></iframe>
|
||||
|
||||
<script src="./xznstatic/js/jquery-1.11.3.min.js"></script>
|
||||
<script src="./layui/layui.js"></script>
|
||||
<script src="./js/vue.js"></script>
|
||||
<script src="./js/config.js"></script>
|
||||
|
||||
<script>
|
||||
var vue = new Vue({
|
||||
el: '#header',
|
||||
data: {
|
||||
indexNav: indexNav,
|
||||
cartFlag: cartFlag,
|
||||
adminurl: adminurl,
|
||||
chatFlag: chatFlag,
|
||||
projectName: projectName
|
||||
},
|
||||
mounted: function() {
|
||||
this.bindClickOnLi();
|
||||
},
|
||||
methods: {
|
||||
jump(url) {
|
||||
jump(url)
|
||||
},
|
||||
bindClickOnLi() {
|
||||
let list = document.getElementsByTagName("li");
|
||||
for(var i = 0;i<list.length;i++){
|
||||
list[i].onclick = function(){
|
||||
$(this).addClass("current").siblings().removeClass("current");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
layui.use(['element','layer'], function() {
|
||||
var element = layui.element;
|
||||
var layer = layui.layer;
|
||||
});
|
||||
|
||||
function chatTap(){
|
||||
var userTable = localStorage.getItem('userTable');
|
||||
if (userTable) {
|
||||
layui.layer.open({
|
||||
type: 2,
|
||||
title: '客服聊天',
|
||||
area: ['600px', '600px'],
|
||||
content: './pages/chat/chat.html'
|
||||
});
|
||||
} else {
|
||||
window.location.href = './pages/login/login.html'
|
||||
}
|
||||
}
|
||||
|
||||
// 导航栏跳转
|
||||
function navPage(url) {
|
||||
localStorage.setItem('iframeUrl', url);
|
||||
document.getElementById('iframe').src = url;
|
||||
}
|
||||
|
||||
// 跳转到个人中心也
|
||||
function centerPage() {
|
||||
var userTable = localStorage.getItem('userTable');
|
||||
if (userTable) {
|
||||
localStorage.setItem('iframeUrl', './pages/' + userTable + '/center.html');
|
||||
document.getElementById('iframe').src = './pages/' + userTable + '/center.html';
|
||||
} else {
|
||||
window.location.href = './pages/login/login.html'
|
||||
}
|
||||
}
|
||||
|
||||
var iframeUrl = localStorage.getItem('iframeUrl');
|
||||
document.getElementById('iframe').src = iframeUrl;
|
||||
|
||||
changeFrameHeight();
|
||||
|
||||
// 窗口变化时候iframe自适应
|
||||
function changeFrameHeight() {
|
||||
var header = document.getElementById('header').scrollHeight;
|
||||
var ifm = document.getElementById("iframe");
|
||||
ifm.height = document.documentElement.clientHeight - header;
|
||||
ifm.width = document.documentElement.clientWidth;
|
||||
}
|
||||
|
||||
// reasize 事件 窗口大小变化后执行的方法
|
||||
window.onresize = function() {
|
||||
changeFrameHeight();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,707 @@
|
||||
/**
|
||||
* BootstrapAMapPositionPicker v0.8.3
|
||||
* @author: Kinegratii
|
||||
*/
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['jquery', 'AMap'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory(require('jquery'), require('AMap'));
|
||||
} else {
|
||||
if (typeof jQuery === 'undefined') {
|
||||
throw 'AMapPositionPicker requires jQuery to be loaded first';
|
||||
}
|
||||
if (typeof AMap == 'undefined') {
|
||||
throw 'AMapPositionPicker requires AMap to be loaded first';
|
||||
}
|
||||
factory(jQuery, AMap);
|
||||
}
|
||||
}(function ($, AMap) {
|
||||
// Global tool functions
|
||||
String.prototype.format = function (data) {
|
||||
var result = this;
|
||||
for (var key in data) {
|
||||
if (data[key] != undefined) {
|
||||
var reg = new RegExp("({" + key + "})", "g");
|
||||
result = result.replace(reg, data[key]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
if (typeof String.prototype.startsWith != 'function') {
|
||||
String.prototype.startsWith = function (prefix) {
|
||||
return this.slice(0, prefix.length) === prefix;
|
||||
};
|
||||
}
|
||||
|
||||
function wrapFormat(formatter, data) {
|
||||
if (typeof formatter == 'function') {
|
||||
return formatter(data);
|
||||
} else if (typeof formatter == 'string') {
|
||||
return formatter.format(data);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
// Data Structure Start
|
||||
var Position = (function () {
|
||||
function Position(longitude, latitude, address, label) {
|
||||
this.longitude = longitude;
|
||||
this.latitude = latitude;
|
||||
this.address = address || '';
|
||||
this.label = label || '';
|
||||
}
|
||||
|
||||
Position.prototype.isValid = function () {
|
||||
return this.longitude != undefined && this.longitude != null && this.latitude != undefined && this.latitude != null;
|
||||
};
|
||||
Position.prototype.copy = function (data) {
|
||||
if (data == undefined) {
|
||||
return new Position(this.longitude, this.latitude, this.address, this.label);
|
||||
} else {
|
||||
return new Position(
|
||||
data.longitude || this.longitude,
|
||||
data.latitude || this.latitude,
|
||||
data.address || this.address,
|
||||
data.label || this.label
|
||||
);
|
||||
}
|
||||
};
|
||||
Position.prototype.getDisplayString = function () {
|
||||
if (this.label) {
|
||||
return this.label;
|
||||
} else {
|
||||
return this.address;
|
||||
}
|
||||
};
|
||||
Position.fromOptions = function (options) {
|
||||
if (options instanceof Position) {
|
||||
return options;
|
||||
} else {
|
||||
return new Position(options.longitude, options.latitude, options.address, options.label);
|
||||
}
|
||||
};
|
||||
Position.empty = function () {
|
||||
return new Position(null, null, "", "");
|
||||
};
|
||||
Position.validate = function (position) {
|
||||
if (position) {
|
||||
return position.isValid();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
Position.validateLngLat = function (lnglatStr) {
|
||||
var result = /^([+-]?(0?\d{1,2}(\.\d{1,6})?|1[0-7]?\d{1}(\.\d{1,6})?|180\.0{1,6}))[-;,]([-+]?([0-8]?\d{1}(\.\d{1,6})?|90(\.0{1,6})?))$/.exec(lnglatStr);
|
||||
if (result) {
|
||||
return {longitude: parseFloat(result[1]), latitude: parseFloat(result[5])};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Position.LNGLAT_FORMATTER = ['{longitude}-{latitude}', '{longitude};{latitude}', '{longitude},{latitude}'];
|
||||
return Position;
|
||||
}());
|
||||
|
||||
var Field = (function () {
|
||||
var idIndex = -1;
|
||||
|
||||
function generateSelectorId(selector) {
|
||||
if (selector.startsWith('#')) {
|
||||
return selector.substring(1);
|
||||
} else {
|
||||
idIndex += 1;
|
||||
return 'id_ampp_i' + idIndex;
|
||||
}
|
||||
}
|
||||
|
||||
function Field(options) {
|
||||
this.name = options.name;
|
||||
if (options.selector instanceof jQuery) {
|
||||
this.$widget = options.selector;
|
||||
this.created = true;
|
||||
}
|
||||
else if ($(options.selector).length > 0) {
|
||||
this.$widget = $(options.selector);
|
||||
this.created = true;
|
||||
} else {
|
||||
var inputHtml = '<input type="hidden" id="{id}" name="{name}"/>'.format({
|
||||
id: generateSelectorId(options.selector),
|
||||
name: options.name
|
||||
});
|
||||
this.$widget = $(inputHtml);
|
||||
this.created = false;
|
||||
}
|
||||
this.formatter = function (position) {
|
||||
return wrapFormat(options.formatter, position);
|
||||
};
|
||||
}
|
||||
|
||||
Field.prototype.render = function (position, hasPicked) {
|
||||
|
||||
var v;
|
||||
if (hasPicked) {
|
||||
v = this.formatter(position);
|
||||
} else {
|
||||
v = '';
|
||||
}
|
||||
console.log(v);
|
||||
if (this.$widget.is('input') || this.$widget.is('textarea')) {
|
||||
this.$widget.val(v);
|
||||
} else if (this.$widget.is('div') || this.$widget.is('td') || this.$widget.is('p')) {
|
||||
this.$widget.html(v);
|
||||
}
|
||||
};
|
||||
|
||||
return Field;
|
||||
|
||||
}());
|
||||
|
||||
var FieldManager = (function () {
|
||||
var fields = [];
|
||||
|
||||
function FieldManager() {
|
||||
fields = [];
|
||||
}
|
||||
|
||||
FieldManager.prototype.addField = function (field) {
|
||||
fields.push(field);
|
||||
};
|
||||
|
||||
FieldManager.prototype.render = function (position, hasPicked) {
|
||||
for (var i = 0.; i < fields.length; i++) {
|
||||
fields[i].render(position, hasPicked);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return FieldManager;
|
||||
|
||||
}());
|
||||
|
||||
// Data Structure End
|
||||
|
||||
function buildBootstrapModalHTML() {
|
||||
var toolsHtml = '<div class="btn-group">'
|
||||
+ '<button id="idAMapPositionPickerLocation" type="button" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-map-marker"></span> 定位</button>'
|
||||
+ '<button id="idAMapPositionPickerReset" type="button" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-repeat"></span> 重置</button>'
|
||||
+ '<button id="idAMapPositionPickerClear" type="button" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-remove"></span> 清除</button>'
|
||||
+ '<button id="idAMapPositionPickerSearch" type="button" class="btn btn-default btn-sm" data-toggle="collapse" data-target="#idAMapPositionPickerSearchPanel"><span class="glyphicon glyphicon-search"></span> 搜索</button>'
|
||||
+ '</div>';
|
||||
var searchPanelHtml = '<div id="idAMapPositionPickerSearchPanel" class="collapse"><input class="form-control input-sm" id="idAMapPositionPickerSearchInput"/><ul id="idAMapPositionPickerSearchResult" class="list-group"></ul></div>';
|
||||
var mapPanelHtml = '<div id="idAMapPositionPickerFloatContainer" style="position: absolute;z-index: 2;top:5px;right: 5px;">' + toolsHtml + searchPanelHtml + '</div>';
|
||||
var modalHtml = '<div class="modal fade" id="idAMapPositionPickerModal">'
|
||||
+ '<div class="modal-dialog">'
|
||||
+ '<div class="modal-content">'
|
||||
+ '<div class="modal-header"><button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button><h4 class="modal-title">请选择地址</h4><small id="idAMapPositionPickerAlert" style="color: red">必须选择一个位置</small></div>'
|
||||
+ '<div class="modal-body">'
|
||||
+ '<div id="idAMapPositionPickerMap" style="height: 500px;" class="form-control">'
|
||||
+ mapPanelHtml
|
||||
+ '</div>' //End of Map container
|
||||
+ '<input class="form-control input-sm" style="margin-top:5px;" id="idAMapPositionPickerAddress"/>'
|
||||
+ '</div>' //End of modal-Body
|
||||
+ '<div class="modal-footer">'
|
||||
+ '<button id="idAMapPositionPickerSelect" type="button" class="btn btn-primary btn-sm">确定</button><button id="idAMapPositionPickerCancelBtn" type="button" class="btn btn-default btn-sm" data-dismiss="modal">取消</button>'
|
||||
+ '</div>' //End of Modal-footer
|
||||
+ '</div>' //End of Modal-content
|
||||
+ '</div>' // End of Modal-dialog
|
||||
+ '</div>';//End of Modal
|
||||
return modalHtml;
|
||||
}
|
||||
|
||||
var PICKER_CONTROLLER = (function () {
|
||||
// Common Modal Controller for all elements
|
||||
|
||||
// Context pick
|
||||
var mPicker = null;
|
||||
var mapObj = null;
|
||||
|
||||
var isShowOrPickMode = false;
|
||||
|
||||
var $modal = null, $map, $addressInput, $alert, $pickBtn, $locationBtn, $resetBtn, $clearBtn, $cancelBtn;
|
||||
|
||||
// Current picked
|
||||
var selectedMarker = null;
|
||||
var cachePosition = Position.empty();
|
||||
// Search plugin
|
||||
var $searchBtn, $searchPanel, $searchInput, $searchResultList;
|
||||
var markerList = [];
|
||||
|
||||
var geolocation;
|
||||
|
||||
|
||||
var mapClickClickHandler = function (e) {
|
||||
$alert.hide();
|
||||
selectMarker(createMarkerFromLnglat(e.lnglat.lng, e.lnglat.lat));
|
||||
};
|
||||
|
||||
function activate(picker) {
|
||||
mPicker = picker;
|
||||
showModal();
|
||||
}
|
||||
|
||||
function deactivate() {
|
||||
mPicker = null;
|
||||
}
|
||||
|
||||
function showModal() {
|
||||
initializeController();
|
||||
initializePicker();
|
||||
|
||||
var p = mPicker.position();
|
||||
if (p && p.isValid()) {
|
||||
selectMarker(createMarkerFromPosition(p));
|
||||
} else {
|
||||
if (selectedMarker) {
|
||||
selectedMarker.setMap(null);
|
||||
}
|
||||
$addressInput.val('');
|
||||
if (mPicker.opts.center.longitude && mPicker.opts.center.latitude) {
|
||||
mapObj.setCenter(new AMap.LngLat(mPicker.opts.center.longitude, mPicker.opts.center.latitude));
|
||||
}
|
||||
}
|
||||
$modal.modal('show');
|
||||
}
|
||||
|
||||
|
||||
function initializeController() {
|
||||
// Initialize global options
|
||||
if ($modal == null) {
|
||||
$modal = $(buildBootstrapModalHTML());
|
||||
$(document.body).append($modal);
|
||||
mapObj = new AMap.Map("idAMapPositionPickerMap", {
|
||||
zoom: 15
|
||||
});
|
||||
AMap.plugin(['AMap.ToolBar', 'AMap.Scale', 'AMap.OverView'],
|
||||
function () {
|
||||
mapObj.addControl(new AMap.ToolBar());
|
||||
mapObj.addControl(new AMap.Scale());
|
||||
mapObj.addControl(new AMap.OverView({isOpen: true}));
|
||||
});
|
||||
mapObj.on('click', mapClickClickHandler);
|
||||
mapObj.plugin('AMap.Geolocation', function () {
|
||||
geolocation = new AMap.Geolocation({
|
||||
enableHighAccuracy: true,
|
||||
timeout: 3000,
|
||||
maximumAge: 0,
|
||||
convert: true,
|
||||
panToLocation: true,
|
||||
zoomToAccuracy: true,
|
||||
markerOptions: {}
|
||||
});
|
||||
});
|
||||
// DOM Selectors and events
|
||||
$map = $("#idAMapPositionPickerMap");
|
||||
$pickBtn = $("#idAMapPositionPickerSelect");
|
||||
$locationBtn = $("#idAMapPositionPickerLocation");
|
||||
$resetBtn = $("#idAMapPositionPickerReset");
|
||||
$clearBtn = $("#idAMapPositionPickerClear");
|
||||
$addressInput = $("#idAMapPositionPickerAddress");
|
||||
$cancelBtn = $("#idAMapPositionPickerCancelBtn");
|
||||
$alert = $("#idAMapPositionPickerAlert");
|
||||
|
||||
$searchBtn = $("#idAMapPositionPickerSearch");
|
||||
$searchPanel = $("#idAMapPositionPickerSearchPanel");
|
||||
$searchInput = $("#idAMapPositionPickerSearchInput");
|
||||
$searchResultList = $("#idAMapPositionPickerSearchResult");
|
||||
|
||||
$pickBtn.on('click', pickPosition);
|
||||
$resetBtn.on('click', resetInitialPosition);
|
||||
$clearBtn.on('click', clearPosition);
|
||||
$locationBtn.on('click', location);
|
||||
$searchPanel.on('show.bs.collapse', function () {
|
||||
$searchBtn.removeClass('btn-default').addClass('btn-primary');
|
||||
startSearch();
|
||||
}).on('hide.bs.collapse', function () {
|
||||
$searchBtn.removeClass('btn-primary').addClass('btn-default');
|
||||
endSearch();
|
||||
});
|
||||
$('ul#idAMapPositionPickerSearchResult').on('click', 'li[data-poi-index]', highlightMarker);
|
||||
}
|
||||
}
|
||||
|
||||
function initializePicker() {
|
||||
toggleMode(false);
|
||||
$map.css('height', mPicker.opts.height);
|
||||
$modal.find('h4.modal-title').html(mPicker.opts.title);
|
||||
$alert.hide();
|
||||
|
||||
}
|
||||
|
||||
function location() {
|
||||
$alert.hide();
|
||||
geolocation.getCurrentPosition(function (status, result) {
|
||||
if (status == 'complete') {
|
||||
selectMarker(createMarkerFromLnglat(result.position.lng, result.position.lat, result.formattedAddress))
|
||||
} else {
|
||||
$alert.html(result.message).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function clearPosition() {
|
||||
cachePosition = Position.empty();
|
||||
if (selectedMarker != null) {
|
||||
selectedMarker.setMap(null);
|
||||
}
|
||||
$addressInput.val('');
|
||||
}
|
||||
|
||||
function resetInitialPosition() {
|
||||
cachePosition = mPicker.getInitialPosition();
|
||||
if (Position.validate(cachePosition)) {
|
||||
selectMarker(createMarkerFromPosition(cachePosition));
|
||||
} else if (selectedMarker != null) {
|
||||
selectedMarker.setMap(null);
|
||||
$addressInput.val('');
|
||||
}
|
||||
}
|
||||
|
||||
function isPositionPicked() {
|
||||
return cachePosition.isValid();
|
||||
}
|
||||
|
||||
function pickPosition() {
|
||||
if (isShowOrPickMode) {
|
||||
$modal.modal('hide');
|
||||
return;
|
||||
}
|
||||
var address = $addressInput.val();
|
||||
cachePosition.address = address;
|
||||
|
||||
// Always use new position instance
|
||||
var pickedPosition;
|
||||
var hasPicked = isPositionPicked();
|
||||
if (hasPicked) {
|
||||
pickedPosition = cachePosition.copy();
|
||||
} else {
|
||||
pickedPosition = Position.empty();
|
||||
}
|
||||
|
||||
if (mPicker.opts.required && !hasPicked) {
|
||||
$alert.html(mPicker.opts.errorTip).show();
|
||||
} else {
|
||||
$alert.hide();
|
||||
$modal.modal('hide');
|
||||
mPicker._onPickedCallback(pickedPosition, hasPicked);
|
||||
}
|
||||
}
|
||||
|
||||
// Search Start
|
||||
function highlightMarker(e) {
|
||||
|
||||
var index = $(this).data('poiIndex');
|
||||
if (index < markerList.length) {
|
||||
markerList[index].resumeMove();
|
||||
}
|
||||
}
|
||||
|
||||
function startSearch() {
|
||||
mapObj.off('click', mapClickClickHandler);
|
||||
$resetBtn.prop('disabled', true);
|
||||
$clearBtn.prop('disabled', true);
|
||||
$locationBtn.prop('disabled', true);
|
||||
|
||||
$searchInput.on('keydown', function (e) {
|
||||
var searchKeyword = $searchInput.val();
|
||||
if (e.which == '13' && searchKeyword.length > 0) { //Enter
|
||||
AMap.service('AMap.PlaceSearch', function () {
|
||||
var placeSearch = new AMap.PlaceSearch({
|
||||
pageSize: 6,
|
||||
pageIndex: 1,
|
||||
extensions: 'all' // return full address for POI
|
||||
});
|
||||
// Search in the given bound
|
||||
placeSearch.searchInBounds(searchKeyword, mapObj.getBounds(), function (status, result) {
|
||||
$searchResultList.children('li').remove();
|
||||
for (var i in markerList) {
|
||||
markerList[i].setMap(null);
|
||||
}
|
||||
markerList = [];
|
||||
if (status == 'complete') {
|
||||
for (var i in result.poiList.pois) {
|
||||
var poi = result.poiList.pois[i];
|
||||
var li = $('<li data-poi-index="{i}" class="list-group-item"><small>{name}</small></li>'.format({
|
||||
i: i,
|
||||
name: poi.name
|
||||
}));
|
||||
$searchResultList.append(li);
|
||||
// delay to username poi.address
|
||||
var mMarker = createMarkerFromLnglat(poi.location.lng, poi.location.lat);
|
||||
mMarker.on('click', function (e) {
|
||||
selectMarker(e.target);
|
||||
});
|
||||
markerList.push(mMarker);
|
||||
}
|
||||
mapObj.panTo(markerList[0].getPosition());
|
||||
} else {
|
||||
$searchPanel.append('<li class="list-group-item disabled"><small>抱歉,暂无找到符合条件的结果。</small></li>');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function endSearch() {
|
||||
mapObj.on('click', mapClickClickHandler);
|
||||
$resetBtn.prop('disabled', false);
|
||||
$clearBtn.prop('disabled', false);
|
||||
$locationBtn.prop('disabled', false);
|
||||
$searchInput.val('').off('keydown');
|
||||
for (var i in markerList) {
|
||||
markerList[i].setMap(null);
|
||||
}
|
||||
markerList = [];
|
||||
$searchResultList.children('li').remove();
|
||||
}
|
||||
|
||||
// Search End
|
||||
|
||||
|
||||
// New tools
|
||||
|
||||
function createMarkerFromPosition(position) {
|
||||
var markerOpts = {
|
||||
map: mapObj,
|
||||
position: new AMap.LngLat(position.longitude, position.latitude),
|
||||
topWhenClick: true,
|
||||
offset: new AMap.Pixel(-5, -30),
|
||||
animation: 'AMAP_ANIMATION_DROP',
|
||||
extData: position
|
||||
};
|
||||
if (position.address) {
|
||||
markerOpts.title = position.address;
|
||||
}
|
||||
var marker = new AMap.Marker(markerOpts);
|
||||
return marker;
|
||||
}
|
||||
|
||||
function createMarkerFromLnglat(longitude, latitude, address) {
|
||||
var position = new Position(longitude, latitude, address, "");
|
||||
return createMarkerFromPosition(position);
|
||||
}
|
||||
|
||||
function selectMarker(marker) {
|
||||
clearPosition();
|
||||
selectedMarker = marker;
|
||||
var position = marker.getExtData();
|
||||
var lngLat = marker.getPosition();
|
||||
|
||||
cachePosition.longitude = position.longitude;
|
||||
cachePosition.latitude = position.latitude;
|
||||
if (!position.address) {
|
||||
var geocoder;
|
||||
mapObj.plugin(["AMap.Geocoder"], function () {
|
||||
geocoder = new AMap.Geocoder({
|
||||
radius: 1000,
|
||||
extensions: "base"
|
||||
});
|
||||
AMap.event.addListener(geocoder, "complete", function (GeocoderResult) {
|
||||
if (GeocoderResult["info"] == "OK") {
|
||||
var address = GeocoderResult.regeocode.formattedAddress;
|
||||
position.address = address;
|
||||
selectedMarker.setExtData(position);
|
||||
cachePosition.address = address;
|
||||
$addressInput.val(address);
|
||||
mapObj.panTo(lngLat);
|
||||
}
|
||||
});
|
||||
geocoder.getAddress(lngLat);
|
||||
});
|
||||
} else {
|
||||
cachePosition.address = position.address;
|
||||
mapObj.panTo(lngLat);
|
||||
$addressInput.val(position.address);
|
||||
}
|
||||
}
|
||||
|
||||
// End Tool functions
|
||||
|
||||
function toggleMode(isShowOrPick) {
|
||||
isShowOrPickMode = isShowOrPick;
|
||||
|
||||
$addressInput.prop('readonly', isShowOrPick);
|
||||
if (isShowOrPick) {
|
||||
mapObj.off('click', mapClickClickHandler);
|
||||
$cancelBtn.hide();
|
||||
$alert.hide();
|
||||
$('#idAMapPositionPickerFloatContainer').hide();
|
||||
} else {
|
||||
mapObj.on('click', mapClickClickHandler);
|
||||
$('#idAMapPositionPickerFloatContainer').show();
|
||||
$cancelBtn.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function showPositionInMap(position) {
|
||||
initializeController();
|
||||
toggleMode(true);
|
||||
clearPosition();
|
||||
var mMarker = createMarkerFromPosition(position);
|
||||
mapObj.panTo(mMarker.getPosition());
|
||||
$modal.find('h4.modal-title').html(position.getDisplayString());
|
||||
$addressInput.val(position.address);
|
||||
$modal.modal('show');
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
activate: activate,
|
||||
deactivate: activate,
|
||||
//Tools
|
||||
showPositionInMap: showPositionInMap
|
||||
}
|
||||
})();
|
||||
|
||||
var aMapPositionPicker = function (element, options) {
|
||||
|
||||
var picker = {
|
||||
isFirstLoad: false,
|
||||
initialPosition: null,
|
||||
fieldManager: new FieldManager()
|
||||
};
|
||||
var $inputEl = null;
|
||||
|
||||
function triggerPickedComplete(mPosition, hasPicked) {
|
||||
if (options.onPicked) {
|
||||
options.onPicked(mPosition)
|
||||
} else {
|
||||
element.trigger('AMPP.PickCompleted', [mPosition, hasPicked]);
|
||||
}
|
||||
}
|
||||
|
||||
// API for PICKER_CONTROLLER
|
||||
picker._onPickedCallback = function (mPosition, hasPicked) {
|
||||
element.data('position', mPosition);
|
||||
$inputEl.val(wrapFormat(options.formatter, mPosition));
|
||||
picker.fieldManager.render(mPosition, hasPicked);
|
||||
triggerPickedComplete(mPosition, hasPicked);
|
||||
};
|
||||
|
||||
// Public API
|
||||
|
||||
picker.getInitialPosition = function () {
|
||||
return initialPosition;
|
||||
};
|
||||
|
||||
picker.position = function () {
|
||||
var s = JSON.stringify(element.data('position'));
|
||||
return element.data('position');
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
if (element.is('input') || element.is('textarea')) {
|
||||
$inputEl = element;
|
||||
} else {
|
||||
$inputEl = element.children('input');
|
||||
}
|
||||
$inputEl.prop("readonly", true);
|
||||
//Handle initial data
|
||||
if (Position.LNGLAT_FORMATTER.indexOf(options.formatter)) {
|
||||
var result = Position.validateLngLat($inputEl.val());
|
||||
if (result) {
|
||||
options.value.longitude = parseFloat(result.longitude);
|
||||
options.value.latitude = parseFloat(result.latitude);
|
||||
}
|
||||
}
|
||||
var initialPosition = new Position(options.value.longitude, options.value.latitude, options.value.address, options.value.label);
|
||||
element.data('position', initialPosition.copy());
|
||||
// Register events
|
||||
element.on('click', function () {
|
||||
//show modal/
|
||||
PICKER_CONTROLLER.activate(picker);
|
||||
});
|
||||
// 处理fields
|
||||
var fields = options.fields || [];
|
||||
for (var i in fields) {
|
||||
var iEl = new Field(fields[i] || {});
|
||||
if (!iEl.created) {
|
||||
$inputEl.after(iEl.$widget);
|
||||
}
|
||||
picker.fieldManager.addField(iEl);
|
||||
}
|
||||
|
||||
picker.opts = options;
|
||||
return picker;
|
||||
};
|
||||
|
||||
$.fn.AMapPositionPicker = function (options) {
|
||||
options = options || {};
|
||||
var args = Array.prototype.slice.call(arguments, 1),
|
||||
isInstance = true,
|
||||
thisMethods = [], //可级联函数列表
|
||||
returnValue;
|
||||
if (typeof options == 'object') {
|
||||
return this.each(function () {
|
||||
var $this = $(this);
|
||||
if (!$this.data('AMapPositionPicker')) {
|
||||
var dataOptions = {
|
||||
formatter: $this.data('formatter'),
|
||||
title: $this.data('title'),
|
||||
errorTip: $this.data('errorTip'),
|
||||
height: $this.data('height'),
|
||||
required: $this.data('required'),
|
||||
value: {
|
||||
longitude: $this.data('valueLongitude'),
|
||||
latitude: $this.data('valueLatitude'),
|
||||
address: $this.data('valueAddress'),
|
||||
label: $this.data('valueLabel')
|
||||
},
|
||||
center: {
|
||||
longitude: $this.data('centerLongitude'),
|
||||
latitude: $this.data('centerLatitude')
|
||||
}
|
||||
};
|
||||
options = $.extend(true, {}, $.fn.AMapPositionPicker.defaults, dataOptions, options);
|
||||
$this.data('AMapPositionPicker', aMapPositionPicker($this, options));
|
||||
}
|
||||
});
|
||||
} else if (typeof options == 'string') {
|
||||
this.each(function () {
|
||||
var $this = $(this),
|
||||
instance = $this.data('AMapPositionPicker');
|
||||
if (!instance) {
|
||||
throw new Error('AMapPositionPicker("' + options + '") method was called on an element that is not using AMapPositionPicker');
|
||||
}
|
||||
returnValue = instance[options].apply(instance, args);
|
||||
isInstance = returnValue === instance;
|
||||
});
|
||||
if (isInstance || $.inArray(options, thisMethods) > -1) {
|
||||
return this;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
throw new TypeError('Invalid arguments for AMapPositionPicker: ' + options);
|
||||
};
|
||||
$.fn.AMapPositionPicker.defaults = {
|
||||
formatter: '{address}',
|
||||
onPicked: null,
|
||||
value: {
|
||||
longitude: null,
|
||||
latitude: null,
|
||||
address: null
|
||||
},
|
||||
required: true,
|
||||
title: '请选择地址',
|
||||
errorTip: '请选择地址',
|
||||
height: '500px',
|
||||
fields: []
|
||||
};
|
||||
$.extend({AMapPositionPicker: {}});
|
||||
$.extend($.AMapPositionPicker, {
|
||||
showPositionInMap: function (position) {
|
||||
PICKER_CONTROLLER.showPositionInMap(Position.fromOptions(position));
|
||||
},
|
||||
pluginVersion: '0.8.3'
|
||||
});
|
||||
$(function () {
|
||||
$('[data-provide="AMapPositionPicker"]').AMapPositionPicker();
|
||||
});
|
||||
}))
|
||||
;
|
@ -0,0 +1,14 @@
|
||||
window.rootPath = (function (src) {
|
||||
src = document.scripts[document.scripts.length - 1].src;
|
||||
console.log(src.substring(0, src.lastIndexOf("/") + 1))
|
||||
return src.substring(0, src.lastIndexOf("/") + 1);
|
||||
})();
|
||||
|
||||
layui.config({
|
||||
base: rootPath,
|
||||
version: true
|
||||
}).extend({
|
||||
http: 'http/http', // 网络请求接口扩展
|
||||
layarea: 'layarea/layarea' ,// 省市区联动选择器
|
||||
tinymce: 'tinymce/tinymce' // 富文本编辑器
|
||||
});
|
@ -0,0 +1,91 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*/
|
||||
/**
|
||||
* Jquery integration plugin.
|
||||
*
|
||||
* @class tinymce.core.JqueryIntegration
|
||||
* @private
|
||||
*/
|
||||
!function(){var f,c,u,p,d,s=[];d="undefined"!=typeof global?global:window,p=d.jQuery;function v(){
|
||||
// Reference to tinymce needs to be lazily evaluated since tinymce
|
||||
// might be loaded through the compressor or other means
|
||||
return d.tinymce}p.fn.tinymce=function(o){var e,t,i,l=this,r="";
|
||||
// No match then just ignore the call
|
||||
if(!l.length)return l;
|
||||
// Get editor instance
|
||||
if(!o)return v()?v().get(l[0].id):null;l.css("visibility","hidden");function n(){var a=[],c=0;
|
||||
// Apply patches to the jQuery object, only once
|
||||
u||(m(),u=!0),
|
||||
// Create an editor instance for each matched node
|
||||
l.each(function(e,t){var n,i=t.id,r=o.oninit;
|
||||
// Generate unique id for target element if needed
|
||||
i||(t.id=i=v().DOM.uniqueId()),
|
||||
// Only init the editor once
|
||||
v().get(i)||(
|
||||
// Create editor instance and render it
|
||||
n=v().createEditor(i,o),a.push(n),n.on("init",function(){var e,t=r;l.css("visibility",""),
|
||||
// Run this if the oninit setting is defined
|
||||
// this logic will fire the oninit callback ones each
|
||||
// matched editor instance is initialized
|
||||
r&&++c==a.length&&("string"==typeof t&&(e=-1===t.indexOf(".")?null:v().resolve(t.replace(/\.\w+$/,"")),t=v().resolve(t)),
|
||||
// Call the oninit function with the object
|
||||
t.apply(e||v(),a))}))}),
|
||||
// Render the editor instances in a separate loop since we
|
||||
// need to have the full editors array used in the onInit calls
|
||||
p.each(a,function(e,t){t.render()})}
|
||||
// Load TinyMCE on demand, if we need to
|
||||
if(d.tinymce||c||!(e=o.script_url))
|
||||
// Delay the init call until tinymce is loaded
|
||||
1===c?s.push(n):n();else{c=1,t=e.substring(0,e.lastIndexOf("/")),
|
||||
// Check if it's a dev/src version they want to load then
|
||||
// make sure that all plugins, themes etc are loaded in source mode as well
|
||||
-1!=e.indexOf(".min")&&(r=".min"),
|
||||
// Setup tinyMCEPreInit object this will later be used by the TinyMCE
|
||||
// core script to locate other resources like CSS files, dialogs etc
|
||||
// You can also predefined a tinyMCEPreInit object and then it will use that instead
|
||||
d.tinymce=d.tinyMCEPreInit||{base:t,suffix:r},
|
||||
// url contains gzip then we assume it's a compressor
|
||||
-1!=e.indexOf("gzip")&&(i=o.language||"en",e=e+(/\?/.test(e)?"&":"?")+"js=true&core=true&suffix="+escape(r)+"&themes="+escape(o.theme||"modern")+"&plugins="+escape(o.plugins||"")+"&languages="+(i||""),
|
||||
// Check if compressor script is already loaded otherwise setup a basic one
|
||||
d.tinyMCE_GZ||(d.tinyMCE_GZ={start:function(){function n(e){v().ScriptLoader.markDone(v().baseURI.toAbsolute(e))}
|
||||
// Add core languages
|
||||
n("langs/"+i+".js"),
|
||||
// Add themes with languages
|
||||
n("themes/"+o.theme+"/theme"+r+".js"),n("themes/"+o.theme+"/langs/"+i+".js"),
|
||||
// Add plugins with languages
|
||||
p.each(o.plugins.split(","),function(e,t){t&&(n("plugins/"+t+"/plugin"+r+".js"),n("plugins/"+t+"/langs/"+i+".js"))})},end:function(){}}));var a=document.createElement("script");a.type="text/javascript",a.onload=a.onreadystatechange=function(e){e=e||window.event,2===c||"load"!=e.type&&!/complete|loaded/.test(a.readyState)||(v().dom.Event.domLoaded=1,c=2,
|
||||
// Execute callback after mainscript has been loaded and before the initialization occurs
|
||||
o.script_loaded&&o.script_loaded(),n(),p.each(s,function(e,t){t()}))},a.src=e,document.body.appendChild(a)}return l},
|
||||
// Add :tinymce pseudo selector this will select elements that has been converted into editor instances
|
||||
// it's now possible to use things like $('*:tinymce') to get all TinyMCE bound elements.
|
||||
p.extend(p.expr[":"],{tinymce:function(e){var t;return!!(e.id&&"tinymce"in d&&(t=v().get(e.id))&&t.editorManager===v())}});
|
||||
// This function patches internal jQuery functions so that if
|
||||
// you for example remove an div element containing an editor it's
|
||||
// automatically destroyed by the TinyMCE API
|
||||
var m=function(){function r(e){
|
||||
// If the function is remove
|
||||
"remove"===e&&this.each(function(e,t){var n=u(t);n&&n.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(e,t){var n=v().get(t.id.replace(/_parent$/,""));n&&n.remove()})}function o(i){var e,t=this;
|
||||
// Handle set value
|
||||
/*jshint eqnull:true */if(null!=i)r.call(t),
|
||||
// Saves the contents before get/set value of textarea/div
|
||||
t.each(function(e,t){var n;(n=v().get(t.id))&&n.setContent(i)});else if(0<t.length&&(e=v().get(t[0].id)))return e.getContent()}function l(e){return!!(e&&e.length&&d.tinymce&&e.is(":tinymce"))}
|
||||
// Removes any child editor instances by looking for editor wrapper elements
|
||||
var u=function(e){var t=null;return e&&e.id&&d.tinymce&&(t=v().get(e.id)),t},s={};
|
||||
// Loads or saves contents from/to textarea if the value
|
||||
// argument is defined it will set the TinyMCE internal contents
|
||||
// Patch some setter/getter functions these will
|
||||
// now be able to set/get the contents of editor instances for
|
||||
// example $('#editorid').html('Content'); will update the TinyMCE iframe instance
|
||||
p.each(["text","html","val"],function(e,t){var a=s[t]=p.fn[t],c="text"===t;p.fn[t]=function(e){var t=this;if(!l(t))return a.apply(t,arguments);if(e!==f)return o.call(t.filter(":tinymce"),e),a.apply(t.not(":tinymce"),arguments),t;// return original set for chaining
|
||||
var i="",r=arguments;return(c?t:t.eq(0)).each(function(e,t){var n=u(t);i+=n?c?n.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):n.getContent({save:!0}):a.apply(p(t),r)}),i}}),
|
||||
// Makes it possible to use $('#id').append("content"); to append contents to the TinyMCE editor iframe
|
||||
p.each(["append","prepend"],function(e,t){var n=s[t]=p.fn[t],r="prepend"===t;p.fn[t]=function(i){var e=this;return l(e)?i!==f?("string"==typeof i&&e.filter(":tinymce").each(function(e,t){var n=u(t);n&&n.setContent(r?i+n.getContent():n.getContent()+i)}),n.apply(e.not(":tinymce"),arguments),e):void 0:n.apply(e,arguments)}}),
|
||||
// Makes sure that the editor instance gets properly destroyed when the parent element is removed
|
||||
p.each(["remove","replaceWith","replaceAll","empty"],function(e,t){var n=s[t]=p.fn[t];p.fn[t]=function(){return r.call(this,t),n.apply(this,arguments)}}),s.attr=p.fn.attr,
|
||||
// Makes sure that $('#tinymce_id').attr('value') gets the editors current HTML contents
|
||||
p.fn.attr=function(e,t){var n=this,i=arguments;if(!e||"value"!==e||!l(n))return s.attr.apply(n,i);if(t!==f)return o.call(n.filter(":tinymce"),t),s.attr.apply(n.not(":tinymce"),i),n;// return original set for chaining
|
||||
var r=n[0],a=u(r);return a?a.getContent({save:!0}):s.attr.apply(p(r),i)}}}();
|
@ -0,0 +1,3 @@
|
||||
This is where language files should be placed.
|
||||
|
||||
Please DO NOT translate these directly use this service: https://www.transifex.com/projects/p/tinymce/
|
@ -0,0 +1,419 @@
|
||||
tinymce.addI18n('zh_CN',{
|
||||
"Redo": "\u91cd\u505a",
|
||||
"Undo": "\u64a4\u9500",
|
||||
"Cut": "\u526a\u5207",
|
||||
"Copy": "\u590d\u5236",
|
||||
"Paste": "\u7c98\u8d34",
|
||||
"Select all": "\u5168\u9009",
|
||||
"New document": "\u65b0\u6587\u4ef6",
|
||||
"Ok": "\u786e\u5b9a",
|
||||
"Cancel": "\u53d6\u6d88",
|
||||
"Visual aids": "\u7f51\u683c\u7ebf",
|
||||
"Bold": "\u7c97\u4f53",
|
||||
"Italic": "\u659c\u4f53",
|
||||
"Underline": "\u4e0b\u5212\u7ebf",
|
||||
"Strikethrough": "\u5220\u9664\u7ebf",
|
||||
"Superscript": "\u4e0a\u6807",
|
||||
"Subscript": "\u4e0b\u6807",
|
||||
"Clear formatting": "\u6e05\u9664\u683c\u5f0f",
|
||||
"Align left": "\u5de6\u8fb9\u5bf9\u9f50",
|
||||
"Align center": "\u4e2d\u95f4\u5bf9\u9f50",
|
||||
"Align right": "\u53f3\u8fb9\u5bf9\u9f50",
|
||||
"Justify": "\u4e24\u7aef\u5bf9\u9f50",
|
||||
"Bullet list": "\u9879\u76ee\u7b26\u53f7",
|
||||
"Numbered list": "\u7f16\u53f7\u5217\u8868",
|
||||
"Decrease indent": "\u51cf\u5c11\u7f29\u8fdb",
|
||||
"Increase indent": "\u589e\u52a0\u7f29\u8fdb",
|
||||
"Close": "\u5173\u95ed",
|
||||
"Formats": "\u683c\u5f0f",
|
||||
"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "\u4f60\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u6253\u5f00\u526a\u8d34\u677f\uff0c\u8bf7\u4f7f\u7528Ctrl+X\/C\/V\u7b49\u5feb\u6377\u952e\u3002",
|
||||
"Headers": "\u6807\u9898",
|
||||
"Header 1": "\u6807\u98981",
|
||||
"Header 2": "\u6807\u98982",
|
||||
"Header 3": "\u6807\u98983",
|
||||
"Header 4": "\u6807\u98984",
|
||||
"Header 5": "\u6807\u98985",
|
||||
"Header 6": "\u6807\u98986",
|
||||
"Headings": "\u6807\u9898",
|
||||
"Heading 1": "\u6807\u98981",
|
||||
"Heading 2": "\u6807\u98982",
|
||||
"Heading 3": "\u6807\u98983",
|
||||
"Heading 4": "\u6807\u98984",
|
||||
"Heading 5": "\u6807\u98985",
|
||||
"Heading 6": "\u6807\u98986",
|
||||
"Preformatted": "\u9884\u5148\u683c\u5f0f\u5316\u7684",
|
||||
"Div": "Div",
|
||||
"Pre": "Pre",
|
||||
"Code": "\u4ee3\u7801",
|
||||
"Paragraph": "\u6bb5\u843d",
|
||||
"Blockquote": "\u5f15\u6587\u533a\u5757",
|
||||
"Inline": "\u6587\u672c",
|
||||
"Blocks": "\u57fa\u5757",
|
||||
"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "\u5f53\u524d\u4e3a\u7eaf\u6587\u672c\u7c98\u8d34\u6a21\u5f0f\uff0c\u518d\u6b21\u70b9\u51fb\u53ef\u4ee5\u56de\u5230\u666e\u901a\u7c98\u8d34\u6a21\u5f0f\u3002",
|
||||
"Fonts": "\u5b57\u4f53",
|
||||
"Font Sizes": "\u5b57\u53f7",
|
||||
"Class": "\u7c7b\u578b",
|
||||
"Browse for an image": "\u6d4f\u89c8\u56fe\u50cf",
|
||||
"OR": "\u6216",
|
||||
"Drop an image here": "\u62d6\u653e\u4e00\u5f20\u56fe\u50cf\u81f3\u6b64",
|
||||
"Upload": "\u4e0a\u4f20",
|
||||
"Block": "\u5757",
|
||||
"Align": "\u5bf9\u9f50",
|
||||
"Default": "\u9ed8\u8ba4",
|
||||
"Circle": "\u7a7a\u5fc3\u5706",
|
||||
"Disc": "\u5b9e\u5fc3\u5706",
|
||||
"Square": "\u65b9\u5757",
|
||||
"Lower Alpha": "\u5c0f\u5199\u82f1\u6587\u5b57\u6bcd",
|
||||
"Lower Greek": "\u5c0f\u5199\u5e0c\u814a\u5b57\u6bcd",
|
||||
"Lower Roman": "\u5c0f\u5199\u7f57\u9a6c\u5b57\u6bcd",
|
||||
"Upper Alpha": "\u5927\u5199\u82f1\u6587\u5b57\u6bcd",
|
||||
"Upper Roman": "\u5927\u5199\u7f57\u9a6c\u5b57\u6bcd",
|
||||
"Anchor...": "\u951a\u70b9...",
|
||||
"Name": "\u540d\u79f0",
|
||||
"Id": "\u6807\u8bc6\u7b26",
|
||||
"Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.": "\u6807\u8bc6\u7b26\u5e94\u8be5\u4ee5\u5b57\u6bcd\u5f00\u5934\uff0c\u540e\u8ddf\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u7834\u6298\u53f7\u3001\u70b9\u3001\u5192\u53f7\u6216\u4e0b\u5212\u7ebf\u3002",
|
||||
"You have unsaved changes are you sure you want to navigate away?": "\u4f60\u8fd8\u6709\u6587\u6863\u5c1a\u672a\u4fdd\u5b58\uff0c\u786e\u5b9a\u8981\u79bb\u5f00\uff1f",
|
||||
"Restore last draft": "\u6062\u590d\u4e0a\u6b21\u7684\u8349\u7a3f",
|
||||
"Special character...": "\u7279\u6b8a\u5b57\u7b26...",
|
||||
"Source code": "\u6e90\u4ee3\u7801",
|
||||
"Insert\/Edit code sample": "\u63d2\u5165\/\u7f16\u8f91\u4ee3\u7801\u793a\u4f8b",
|
||||
"Language": "\u8bed\u8a00",
|
||||
"Code sample...": "\u793a\u4f8b\u4ee3\u7801...",
|
||||
"Color Picker": "\u9009\u8272\u5668",
|
||||
"R": "R",
|
||||
"G": "G",
|
||||
"B": "B",
|
||||
"Left to right": "\u4ece\u5de6\u5230\u53f3",
|
||||
"Right to left": "\u4ece\u53f3\u5230\u5de6",
|
||||
"Emoticons...": "\u8868\u60c5\u7b26\u53f7...",
|
||||
"Metadata and Document Properties": "\u5143\u6570\u636e\u548c\u6587\u6863\u5c5e\u6027",
|
||||
"Title": "\u6807\u9898",
|
||||
"Keywords": "\u5173\u952e\u8bcd",
|
||||
"Description": "\u63cf\u8ff0",
|
||||
"Robots": "\u673a\u5668\u4eba",
|
||||
"Author": "\u4f5c\u8005",
|
||||
"Encoding": "\u7f16\u7801",
|
||||
"Fullscreen": "\u5168\u5c4f",
|
||||
"Action": "\u64cd\u4f5c",
|
||||
"Shortcut": "\u5feb\u6377\u952e",
|
||||
"Help": "\u5e2e\u52a9",
|
||||
"Address": "\u5730\u5740",
|
||||
"Focus to menubar": "\u79fb\u52a8\u7126\u70b9\u5230\u83dc\u5355\u680f",
|
||||
"Focus to toolbar": "\u79fb\u52a8\u7126\u70b9\u5230\u5de5\u5177\u680f",
|
||||
"Focus to element path": "\u79fb\u52a8\u7126\u70b9\u5230\u5143\u7d20\u8def\u5f84",
|
||||
"Focus to contextual toolbar": "\u79fb\u52a8\u7126\u70b9\u5230\u4e0a\u4e0b\u6587\u83dc\u5355",
|
||||
"Insert link (if link plugin activated)": "\u63d2\u5165\u94fe\u63a5 (\u5982\u679c\u94fe\u63a5\u63d2\u4ef6\u5df2\u6fc0\u6d3b)",
|
||||
"Save (if save plugin activated)": "\u4fdd\u5b58(\u5982\u679c\u4fdd\u5b58\u63d2\u4ef6\u5df2\u6fc0\u6d3b)",
|
||||
"Find (if searchreplace plugin activated)": "\u67e5\u627e(\u5982\u679c\u67e5\u627e\u66ff\u6362\u63d2\u4ef6\u5df2\u6fc0\u6d3b)",
|
||||
"Plugins installed ({0}):": "\u5df2\u5b89\u88c5\u63d2\u4ef6 ({0}):",
|
||||
"Premium plugins:": "\u4f18\u79c0\u63d2\u4ef6\uff1a",
|
||||
"Learn more...": "\u4e86\u89e3\u66f4\u591a...",
|
||||
"You are using {0}": "\u4f60\u6b63\u5728\u4f7f\u7528 {0}",
|
||||
"Plugins": "\u63d2\u4ef6",
|
||||
"Handy Shortcuts": "\u5feb\u6377\u952e",
|
||||
"Horizontal line": "\u6c34\u5e73\u5206\u5272\u7ebf",
|
||||
"Insert\/edit image": "\u63d2\u5165\/\u7f16\u8f91\u56fe\u7247",
|
||||
"Image description": "\u56fe\u7247\u63cf\u8ff0",
|
||||
"Source": "\u5730\u5740",
|
||||
"Dimensions": "\u5927\u5c0f",
|
||||
"Constrain proportions": "\u4fdd\u6301\u7eb5\u6a2a\u6bd4",
|
||||
"General": "\u666e\u901a",
|
||||
"Advanced": "\u9ad8\u7ea7",
|
||||
"Style": "\u6837\u5f0f",
|
||||
"Vertical space": "\u5782\u76f4\u8fb9\u8ddd",
|
||||
"Horizontal space": "\u6c34\u5e73\u8fb9\u8ddd",
|
||||
"Border": "\u8fb9\u6846",
|
||||
"Insert image": "\u63d2\u5165\u56fe\u7247",
|
||||
"Image...": "\u56fe\u7247...",
|
||||
"Image list": "\u56fe\u7247\u5217\u8868",
|
||||
"Rotate counterclockwise": "\u9006\u65f6\u9488\u65cb\u8f6c",
|
||||
"Rotate clockwise": "\u987a\u65f6\u9488\u65cb\u8f6c",
|
||||
"Flip vertically": "\u5782\u76f4\u7ffb\u8f6c",
|
||||
"Flip horizontally": "\u6c34\u5e73\u7ffb\u8f6c",
|
||||
"Edit image": "\u7f16\u8f91\u56fe\u7247",
|
||||
"Image options": "\u56fe\u7247\u9009\u9879",
|
||||
"Zoom in": "\u653e\u5927",
|
||||
"Zoom out": "\u7f29\u5c0f",
|
||||
"Crop": "\u88c1\u526a",
|
||||
"Resize": "\u8c03\u6574\u5927\u5c0f",
|
||||
"Orientation": "\u65b9\u5411",
|
||||
"Brightness": "\u4eae\u5ea6",
|
||||
"Sharpen": "\u9510\u5316",
|
||||
"Contrast": "\u5bf9\u6bd4\u5ea6",
|
||||
"Color levels": "\u989c\u8272\u5c42\u6b21",
|
||||
"Gamma": "\u4f3d\u9a6c\u503c",
|
||||
"Invert": "\u53cd\u8f6c",
|
||||
"Apply": "\u5e94\u7528",
|
||||
"Back": "\u540e\u9000",
|
||||
"Insert date\/time": "\u63d2\u5165\u65e5\u671f\/\u65f6\u95f4",
|
||||
"Date\/time": "\u65e5\u671f\/\u65f6\u95f4",
|
||||
"Insert\/Edit Link": "\u63d2\u5165\/\u7f16\u8f91\u94fe\u63a5",
|
||||
"Insert\/edit link": "\u63d2\u5165\/\u7f16\u8f91\u94fe\u63a5",
|
||||
"Text to display": "\u663e\u793a\u6587\u5b57",
|
||||
"Url": "\u5730\u5740",
|
||||
"Open link in...": "\u94fe\u63a5\u6253\u5f00\u4f4d\u7f6e...",
|
||||
"Current window": "\u5f53\u524d\u7a97\u53e3",
|
||||
"None": "\u65e0",
|
||||
"New window": "\u5728\u65b0\u7a97\u53e3\u6253\u5f00",
|
||||
"Remove link": "\u5220\u9664\u94fe\u63a5",
|
||||
"Anchors": "\u951a\u70b9",
|
||||
"Link...": "\u94fe\u63a5...",
|
||||
"Paste or type a link": "\u7c98\u8d34\u6216\u8f93\u5165\u94fe\u63a5",
|
||||
"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "\u4f60\u6240\u586b\u5199\u7684URL\u5730\u5740\u4e3a\u90ae\u4ef6\u5730\u5740\uff0c\u9700\u8981\u52a0\u4e0amailto:\u524d\u7f00\u5417\uff1f",
|
||||
"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "\u4f60\u6240\u586b\u5199\u7684URL\u5730\u5740\u5c5e\u4e8e\u5916\u90e8\u94fe\u63a5\uff0c\u9700\u8981\u52a0\u4e0ahttp:\/\/:\u524d\u7f00\u5417\uff1f",
|
||||
"Link list": "\u94fe\u63a5\u5217\u8868",
|
||||
"Insert video": "\u63d2\u5165\u89c6\u9891",
|
||||
"Insert\/edit video": "\u63d2\u5165\/\u7f16\u8f91\u89c6\u9891",
|
||||
"Insert\/edit media": "\u63d2\u5165\/\u7f16\u8f91\u5a92\u4f53",
|
||||
"Alternative source": "\u955c\u50cf",
|
||||
"Alternative source URL": "\u66ff\u4ee3\u6765\u6e90\u7f51\u5740",
|
||||
"Media poster (Image URL)": "\u5c01\u9762(\u56fe\u7247\u5730\u5740)",
|
||||
"Paste your embed code below:": "\u5c06\u5185\u5d4c\u4ee3\u7801\u7c98\u8d34\u5728\u4e0b\u9762:",
|
||||
"Embed": "\u5185\u5d4c",
|
||||
"Media...": "\u591a\u5a92\u4f53...",
|
||||
"Nonbreaking space": "\u4e0d\u95f4\u65ad\u7a7a\u683c",
|
||||
"Page break": "\u5206\u9875\u7b26",
|
||||
"Paste as text": "\u7c98\u8d34\u4e3a\u6587\u672c",
|
||||
"Preview": "\u9884\u89c8",
|
||||
"Print...": "\u6253\u5370...",
|
||||
"Save": "\u4fdd\u5b58",
|
||||
"Find": "\u67e5\u627e",
|
||||
"Replace with": "\u66ff\u6362\u4e3a",
|
||||
"Replace": "\u66ff\u6362",
|
||||
"Replace all": "\u5168\u90e8\u66ff\u6362",
|
||||
"Previous": "\u4e0a\u4e00\u4e2a",
|
||||
"Next": "\u4e0b\u4e00\u4e2a",
|
||||
"Find and replace...": "\u67e5\u627e\u5e76\u66ff\u6362...",
|
||||
"Could not find the specified string.": "\u672a\u627e\u5230\u641c\u7d22\u5185\u5bb9.",
|
||||
"Match case": "\u533a\u5206\u5927\u5c0f\u5199",
|
||||
"Find whole words only": "\u5168\u5b57\u5339\u914d",
|
||||
"Spell check": "\u62fc\u5199\u68c0\u67e5",
|
||||
"Ignore": "\u5ffd\u7565",
|
||||
"Ignore all": "\u5168\u90e8\u5ffd\u7565",
|
||||
"Finish": "\u5b8c\u6210",
|
||||
"Add to Dictionary": "\u6dfb\u52a0\u5230\u5b57\u5178",
|
||||
"Insert table": "\u63d2\u5165\u8868\u683c",
|
||||
"Table properties": "\u8868\u683c\u5c5e\u6027",
|
||||
"Delete table": "\u5220\u9664\u8868\u683c",
|
||||
"Cell": "\u5355\u5143\u683c",
|
||||
"Row": "\u884c",
|
||||
"Column": "\u5217",
|
||||
"Cell properties": "\u5355\u5143\u683c\u5c5e\u6027",
|
||||
"Merge cells": "\u5408\u5e76\u5355\u5143\u683c",
|
||||
"Split cell": "\u62c6\u5206\u5355\u5143\u683c",
|
||||
"Insert row before": "\u5728\u4e0a\u65b9\u63d2\u5165",
|
||||
"Insert row after": "\u5728\u4e0b\u65b9\u63d2\u5165",
|
||||
"Delete row": "\u5220\u9664\u884c",
|
||||
"Row properties": "\u884c\u5c5e\u6027",
|
||||
"Cut row": "\u526a\u5207\u884c",
|
||||
"Copy row": "\u590d\u5236\u884c",
|
||||
"Paste row before": "\u7c98\u8d34\u5230\u4e0a\u65b9",
|
||||
"Paste row after": "\u7c98\u8d34\u5230\u4e0b\u65b9",
|
||||
"Insert column before": "\u5728\u5de6\u4fa7\u63d2\u5165",
|
||||
"Insert column after": "\u5728\u53f3\u4fa7\u63d2\u5165",
|
||||
"Delete column": "\u5220\u9664\u5217",
|
||||
"Cols": "\u5217",
|
||||
"Rows": "\u884c",
|
||||
"Width": "\u5bbd",
|
||||
"Height": "\u9ad8",
|
||||
"Cell spacing": "\u5355\u5143\u683c\u5916\u95f4\u8ddd",
|
||||
"Cell padding": "\u5355\u5143\u683c\u5185\u8fb9\u8ddd",
|
||||
"Show caption": "\u663e\u793a\u6807\u9898",
|
||||
"Left": "\u5de6\u5bf9\u9f50",
|
||||
"Center": "\u5c45\u4e2d",
|
||||
"Right": "\u53f3\u5bf9\u9f50",
|
||||
"Cell type": "\u5355\u5143\u683c\u7c7b\u578b",
|
||||
"Scope": "\u8303\u56f4",
|
||||
"Alignment": "\u5bf9\u9f50\u65b9\u5f0f",
|
||||
"H Align": "\u6c34\u5e73\u5bf9\u9f50",
|
||||
"V Align": "\u5782\u76f4\u5bf9\u9f50",
|
||||
"Top": "\u9876\u90e8\u5bf9\u9f50",
|
||||
"Middle": "\u5782\u76f4\u5c45\u4e2d",
|
||||
"Bottom": "\u5e95\u90e8\u5bf9\u9f50",
|
||||
"Header cell": "\u8868\u5934\u5355\u5143\u683c",
|
||||
"Row group": "\u884c\u7ec4",
|
||||
"Column group": "\u5217\u7ec4",
|
||||
"Row type": "\u884c\u7c7b\u578b",
|
||||
"Header": "\u8868\u5934",
|
||||
"Body": "\u8868\u4f53",
|
||||
"Footer": "\u8868\u5c3e",
|
||||
"Border color": "\u8fb9\u6846\u989c\u8272",
|
||||
"Insert template...": "\u63d2\u5165\u6a21\u677f...",
|
||||
"Templates": "\u6a21\u677f",
|
||||
"Template": "\u6a21\u677f",
|
||||
"Text color": "\u6587\u5b57\u989c\u8272",
|
||||
"Background color": "\u80cc\u666f\u8272",
|
||||
"Custom...": "\u81ea\u5b9a\u4e49...",
|
||||
"Custom color": "\u81ea\u5b9a\u4e49\u989c\u8272",
|
||||
"No color": "\u65e0",
|
||||
"Remove color": "\u79fb\u9664\u989c\u8272",
|
||||
"Table of Contents": "\u5185\u5bb9\u5217\u8868",
|
||||
"Show blocks": "\u663e\u793a\u533a\u5757\u8fb9\u6846",
|
||||
"Show invisible characters": "\u663e\u793a\u4e0d\u53ef\u89c1\u5b57\u7b26",
|
||||
"Word count": "\u5b57\u6570",
|
||||
"Count": "\u8ba1\u6570",
|
||||
"Document": "\u6587\u6863",
|
||||
"Selection": "\u9009\u62e9",
|
||||
"Words": "\u5355\u8bcd",
|
||||
"Words: {0}": "\u5b57\u6570\uff1a{0}",
|
||||
"{0} words": "{0} \u5b57",
|
||||
"File": "\u6587\u4ef6",
|
||||
"Edit": "\u7f16\u8f91",
|
||||
"Insert": "\u63d2\u5165",
|
||||
"View": "\u89c6\u56fe",
|
||||
"Format": "\u683c\u5f0f",
|
||||
"Table": "\u8868\u683c",
|
||||
"Tools": "\u5de5\u5177",
|
||||
"Powered by {0}": "\u7531{0}\u9a71\u52a8",
|
||||
"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "\u5728\u7f16\u8f91\u533a\u6309ALT-F9\u6253\u5f00\u83dc\u5355\uff0c\u6309ALT-F10\u6253\u5f00\u5de5\u5177\u680f\uff0c\u6309ALT-0\u67e5\u770b\u5e2e\u52a9",
|
||||
"Image title": "\u56fe\u7247\u6807\u9898",
|
||||
"Border width": "\u8fb9\u6846\u5bbd\u5ea6",
|
||||
"Border style": "\u8fb9\u6846\u6837\u5f0f",
|
||||
"Error": "\u9519\u8bef",
|
||||
"Warn": "\u8b66\u544a",
|
||||
"Valid": "\u6709\u6548",
|
||||
"To open the popup, press Shift+Enter": "\u6309Shitf+Enter\u952e\u6253\u5f00\u5bf9\u8bdd\u6846",
|
||||
"Rich Text Area. Press ALT-0 for help.": "\u7f16\u8f91\u533a\u3002\u6309Alt+0\u952e\u6253\u5f00\u5e2e\u52a9\u3002",
|
||||
"System Font": "\u7cfb\u7edf\u5b57\u4f53",
|
||||
"Failed to upload image: {0}": "\u56fe\u7247\u4e0a\u4f20\u5931\u8d25: {0}",
|
||||
"Failed to load plugin: {0} from url {1}": "\u63d2\u4ef6\u52a0\u8f7d\u5931\u8d25: {0} \u6765\u81ea\u94fe\u63a5 {1}",
|
||||
"Failed to load plugin url: {0}": "\u63d2\u4ef6\u52a0\u8f7d\u5931\u8d25 \u94fe\u63a5: {0}",
|
||||
"Failed to initialize plugin: {0}": "\u63d2\u4ef6\u521d\u59cb\u5316\u5931\u8d25: {0}",
|
||||
"example": "\u793a\u4f8b",
|
||||
"Search": "\u641c\u7d22",
|
||||
"All": "\u5168\u90e8",
|
||||
"Currency": "\u8d27\u5e01",
|
||||
"Text": "\u6587\u5b57",
|
||||
"Quotations": "\u5f15\u7528",
|
||||
"Mathematical": "\u6570\u5b66",
|
||||
"Extended Latin": "\u62c9\u4e01\u8bed\u6269\u5145",
|
||||
"Symbols": "\u7b26\u53f7",
|
||||
"Arrows": "\u7bad\u5934",
|
||||
"User Defined": "\u81ea\u5b9a\u4e49",
|
||||
"dollar sign": "\u7f8e\u5143\u7b26\u53f7",
|
||||
"currency sign": "\u8d27\u5e01\u7b26\u53f7",
|
||||
"euro-currency sign": "\u6b27\u5143\u7b26\u53f7",
|
||||
"colon sign": "\u5192\u53f7",
|
||||
"cruzeiro sign": "\u514b\u9c81\u8d5b\u7f57\u5e01\u7b26\u53f7",
|
||||
"french franc sign": "\u6cd5\u90ce\u7b26\u53f7",
|
||||
"lira sign": "\u91cc\u62c9\u7b26\u53f7",
|
||||
"mill sign": "\u5bc6\u5c14\u7b26\u53f7",
|
||||
"naira sign": "\u5948\u62c9\u7b26\u53f7",
|
||||
"peseta sign": "\u6bd4\u585e\u5854\u7b26\u53f7",
|
||||
"rupee sign": "\u5362\u6bd4\u7b26\u53f7",
|
||||
"won sign": "\u97e9\u5143\u7b26\u53f7",
|
||||
"new sheqel sign": "\u65b0\u8c22\u514b\u5c14\u7b26\u53f7",
|
||||
"dong sign": "\u8d8a\u5357\u76fe\u7b26\u53f7",
|
||||
"kip sign": "\u8001\u631d\u57fa\u666e\u7b26\u53f7",
|
||||
"tugrik sign": "\u56fe\u683c\u91cc\u514b\u7b26\u53f7",
|
||||
"drachma sign": "\u5fb7\u62c9\u514b\u9a6c\u7b26\u53f7",
|
||||
"german penny symbol": "\u5fb7\u56fd\u4fbf\u58eb\u7b26\u53f7",
|
||||
"peso sign": "\u6bd4\u7d22\u7b26\u53f7",
|
||||
"guarani sign": "\u74dc\u62c9\u5c3c\u7b26\u53f7",
|
||||
"austral sign": "\u6fb3\u5143\u7b26\u53f7",
|
||||
"hryvnia sign": "\u683c\u91cc\u592b\u5c3c\u4e9a\u7b26\u53f7",
|
||||
"cedi sign": "\u585e\u5730\u7b26\u53f7",
|
||||
"livre tournois sign": "\u91cc\u5f17\u5f17\u5c14\u7b26\u53f7",
|
||||
"spesmilo sign": "spesmilo\u7b26\u53f7",
|
||||
"tenge sign": "\u575a\u6208\u7b26\u53f7",
|
||||
"indian rupee sign": "\u5370\u5ea6\u5362\u6bd4",
|
||||
"turkish lira sign": "\u571f\u8033\u5176\u91cc\u62c9",
|
||||
"nordic mark sign": "\u5317\u6b27\u9a6c\u514b",
|
||||
"manat sign": "\u9a6c\u7eb3\u7279\u7b26\u53f7",
|
||||
"ruble sign": "\u5362\u5e03\u7b26\u53f7",
|
||||
"yen character": "\u65e5\u5143\u5b57\u6837",
|
||||
"yuan character": "\u4eba\u6c11\u5e01\u5143\u5b57\u6837",
|
||||
"yuan character, in hong kong and taiwan": "\u5143\u5b57\u6837\uff08\u6e2f\u53f0\u5730\u533a\uff09",
|
||||
"yen\/yuan character variant one": "\u5143\u5b57\u6837\uff08\u5927\u5199\uff09",
|
||||
"Loading emoticons...": "\u52a0\u8f7d\u8868\u60c5\u7b26\u53f7...",
|
||||
"Could not load emoticons": "\u4e0d\u80fd\u52a0\u8f7d\u8868\u60c5\u7b26\u53f7",
|
||||
"People": "\u4eba\u7c7b",
|
||||
"Animals and Nature": "\u52a8\u7269\u548c\u81ea\u7136",
|
||||
"Food and Drink": "\u98df\u7269\u548c\u996e\u54c1",
|
||||
"Activity": "\u6d3b\u52a8",
|
||||
"Travel and Places": "\u65c5\u6e38\u548c\u5730\u70b9",
|
||||
"Objects": "\u7269\u4ef6",
|
||||
"Flags": "\u65d7\u5e1c",
|
||||
"Characters": "\u5b57\u7b26",
|
||||
"Characters (no spaces)": "\u5b57\u7b26(\u65e0\u7a7a\u683c)",
|
||||
"{0} characters": "{0} \u4e2a\u5b57\u7b26",
|
||||
"Error: Form submit field collision.": "\u9519\u8bef: \u8868\u5355\u63d0\u4ea4\u5b57\u6bb5\u51b2\u7a81\u3002",
|
||||
"Error: No form element found.": "\u9519\u8bef: \u6ca1\u6709\u8868\u5355\u63a7\u4ef6\u3002",
|
||||
"Update": "\u66f4\u65b0",
|
||||
"Color swatch": "\u989c\u8272\u6837\u672c",
|
||||
"Turquoise": "\u9752\u7eff\u8272",
|
||||
"Green": "\u7eff\u8272",
|
||||
"Blue": "\u84dd\u8272",
|
||||
"Purple": "\u7d2b\u8272",
|
||||
"Navy Blue": "\u6d77\u519b\u84dd",
|
||||
"Dark Turquoise": "\u6df1\u84dd\u7eff\u8272",
|
||||
"Dark Green": "\u6df1\u7eff\u8272",
|
||||
"Medium Blue": "\u4e2d\u84dd\u8272",
|
||||
"Medium Purple": "\u4e2d\u7d2b\u8272",
|
||||
"Midnight Blue": "\u6df1\u84dd\u8272",
|
||||
"Yellow": "\u9ec4\u8272",
|
||||
"Orange": "\u6a59\u8272",
|
||||
"Red": "\u7ea2\u8272",
|
||||
"Light Gray": "\u6d45\u7070\u8272",
|
||||
"Gray": "\u7070\u8272",
|
||||
"Dark Yellow": "\u6697\u9ec4\u8272",
|
||||
"Dark Orange": "\u6df1\u6a59\u8272",
|
||||
"Dark Red": "\u6df1\u7ea2\u8272",
|
||||
"Medium Gray": "\u4e2d\u7070\u8272",
|
||||
"Dark Gray": "\u6df1\u7070\u8272",
|
||||
"Light Green": "\u6d45\u7eff\u8272",
|
||||
"Light Yellow": "\u6d45\u9ec4\u8272",
|
||||
"Light Red": "\u6d45\u7ea2\u8272",
|
||||
"Light Purple": "\u6d45\u7d2b\u8272",
|
||||
"Light Blue": "\u6d45\u84dd\u8272",
|
||||
"Dark Purple": "\u6df1\u7d2b\u8272",
|
||||
"Dark Blue": "\u6df1\u84dd\u8272",
|
||||
"Black": "\u9ed1\u8272",
|
||||
"White": "\u767d\u8272",
|
||||
"Switch to or from fullscreen mode": "\u5207\u6362\u5168\u5c4f\u6a21\u5f0f",
|
||||
"Open help dialog": "\u6253\u5f00\u5e2e\u52a9\u5bf9\u8bdd\u6846",
|
||||
"history": "\u5386\u53f2",
|
||||
"styles": "\u6837\u5f0f",
|
||||
"formatting": "\u683c\u5f0f\u5316",
|
||||
"alignment": "\u5bf9\u9f50",
|
||||
"indentation": "\u7f29\u8fdb",
|
||||
"permanent pen": "\u8bb0\u53f7\u7b14",
|
||||
"comments": "\u5907\u6ce8",
|
||||
"Format Painter": "\u683c\u5f0f\u5237",
|
||||
"Insert\/edit iframe": "\u63d2\u5165\/\u7f16\u8f91\u6846\u67b6",
|
||||
"Capitalization": "\u5927\u5199",
|
||||
"lowercase": "\u5c0f\u5199",
|
||||
"UPPERCASE": "\u5927\u5199",
|
||||
"Title Case": "\u9996\u5b57\u6bcd\u5927\u5199",
|
||||
"Permanent Pen Properties": "\u6c38\u4e45\u7b14\u5c5e\u6027",
|
||||
"Permanent pen properties...": "\u6c38\u4e45\u7b14\u5c5e\u6027...",
|
||||
"Font": "\u5b57\u4f53",
|
||||
"Size": "\u5b57\u53f7",
|
||||
"More...": "\u66f4\u591a...",
|
||||
"Spellcheck Language": "\u62fc\u5199\u68c0\u67e5\u8bed\u8a00",
|
||||
"Select...": "\u9009\u62e9...",
|
||||
"Preferences": "\u9996\u9009\u9879",
|
||||
"Yes": "\u662f",
|
||||
"No": "\u5426",
|
||||
"Keyboard Navigation": "\u952e\u76d8\u6307\u5f15",
|
||||
"Version": "\u7248\u672c",
|
||||
"Anchor": "\u951a\u70b9",
|
||||
"Special character": "\u7279\u6b8a\u7b26\u53f7",
|
||||
"Code sample": "\u4ee3\u7801\u793a\u4f8b",
|
||||
"Color": "\u989c\u8272",
|
||||
"Emoticons": "\u8868\u60c5",
|
||||
"Document properties": "\u6587\u6863\u5c5e\u6027",
|
||||
"Image": "\u56fe\u7247",
|
||||
"Insert link": "\u63d2\u5165\u94fe\u63a5",
|
||||
"Target": "\u6253\u5f00\u65b9\u5f0f",
|
||||
"Link": "\u94fe\u63a5",
|
||||
"Poster": "\u5c01\u9762",
|
||||
"Media": "\u5a92\u4f53",
|
||||
"Print": "\u6253\u5370",
|
||||
"Prev": "\u4e0a\u4e00\u4e2a",
|
||||
"Find and replace": "\u67e5\u627e\u548c\u66ff\u6362",
|
||||
"Whole words": "\u5168\u5b57\u5339\u914d",
|
||||
"Spellcheck": "\u62fc\u5199\u68c0\u67e5",
|
||||
"Caption": "\u6807\u9898",
|
||||
"Insert template": "\u63d2\u5165\u6a21\u677f"
|
||||
});
|
@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
@ -0,0 +1,297 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var applyListFormat = function (editor, listName, styleValue) {
|
||||
var cmd = listName === 'UL' ? 'InsertUnorderedList' : 'InsertOrderedList';
|
||||
editor.execCommand(cmd, false, styleValue === false ? null : { 'list-style-type': styleValue });
|
||||
};
|
||||
var Actions = { applyListFormat: applyListFormat };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('ApplyUnorderedListStyle', function (ui, value) {
|
||||
Actions.applyListFormat(editor, 'UL', value['list-style-type']);
|
||||
});
|
||||
editor.addCommand('ApplyOrderedListStyle', function (ui, value) {
|
||||
Actions.applyListFormat(editor, 'OL', value['list-style-type']);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var getNumberStyles = function (editor) {
|
||||
var styles = editor.getParam('advlist_number_styles', 'default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman');
|
||||
return styles ? styles.split(/[ ,]/) : [];
|
||||
};
|
||||
var getBulletStyles = function (editor) {
|
||||
var styles = editor.getParam('advlist_bullet_styles', 'default,circle,square');
|
||||
return styles ? styles.split(/[ ,]/) : [];
|
||||
};
|
||||
var Settings = {
|
||||
getNumberStyles: getNumberStyles,
|
||||
getBulletStyles: getBulletStyles
|
||||
};
|
||||
|
||||
var noop = function () {
|
||||
};
|
||||
var constant = function (value) {
|
||||
return function () {
|
||||
return value;
|
||||
};
|
||||
};
|
||||
var never = constant(false);
|
||||
var always = constant(true);
|
||||
|
||||
var none = function () {
|
||||
return NONE;
|
||||
};
|
||||
var NONE = function () {
|
||||
var eq = function (o) {
|
||||
return o.isNone();
|
||||
};
|
||||
var call = function (thunk) {
|
||||
return thunk();
|
||||
};
|
||||
var id = function (n) {
|
||||
return n;
|
||||
};
|
||||
var me = {
|
||||
fold: function (n, s) {
|
||||
return n();
|
||||
},
|
||||
is: never,
|
||||
isSome: never,
|
||||
isNone: always,
|
||||
getOr: id,
|
||||
getOrThunk: call,
|
||||
getOrDie: function (msg) {
|
||||
throw new Error(msg || 'error: getOrDie called on none.');
|
||||
},
|
||||
getOrNull: constant(null),
|
||||
getOrUndefined: constant(undefined),
|
||||
or: id,
|
||||
orThunk: call,
|
||||
map: none,
|
||||
each: noop,
|
||||
bind: none,
|
||||
exists: never,
|
||||
forall: always,
|
||||
filter: none,
|
||||
equals: eq,
|
||||
equals_: eq,
|
||||
toArray: function () {
|
||||
return [];
|
||||
},
|
||||
toString: constant('none()')
|
||||
};
|
||||
if (Object.freeze) {
|
||||
Object.freeze(me);
|
||||
}
|
||||
return me;
|
||||
}();
|
||||
var some = function (a) {
|
||||
var constant_a = constant(a);
|
||||
var self = function () {
|
||||
return me;
|
||||
};
|
||||
var bind = function (f) {
|
||||
return f(a);
|
||||
};
|
||||
var me = {
|
||||
fold: function (n, s) {
|
||||
return s(a);
|
||||
},
|
||||
is: function (v) {
|
||||
return a === v;
|
||||
},
|
||||
isSome: always,
|
||||
isNone: never,
|
||||
getOr: constant_a,
|
||||
getOrThunk: constant_a,
|
||||
getOrDie: constant_a,
|
||||
getOrNull: constant_a,
|
||||
getOrUndefined: constant_a,
|
||||
or: self,
|
||||
orThunk: self,
|
||||
map: function (f) {
|
||||
return some(f(a));
|
||||
},
|
||||
each: function (f) {
|
||||
f(a);
|
||||
},
|
||||
bind: bind,
|
||||
exists: bind,
|
||||
forall: bind,
|
||||
filter: function (f) {
|
||||
return f(a) ? me : NONE;
|
||||
},
|
||||
toArray: function () {
|
||||
return [a];
|
||||
},
|
||||
toString: function () {
|
||||
return 'some(' + a + ')';
|
||||
},
|
||||
equals: function (o) {
|
||||
return o.is(a);
|
||||
},
|
||||
equals_: function (o, elementEq) {
|
||||
return o.fold(never, function (b) {
|
||||
return elementEq(a, b);
|
||||
});
|
||||
}
|
||||
};
|
||||
return me;
|
||||
};
|
||||
var from = function (value) {
|
||||
return value === null || value === undefined ? NONE : some(value);
|
||||
};
|
||||
var Option = {
|
||||
some: some,
|
||||
none: none,
|
||||
from: from
|
||||
};
|
||||
|
||||
var isChildOfBody = function (editor, elm) {
|
||||
return editor.$.contains(editor.getBody(), elm);
|
||||
};
|
||||
var isTableCellNode = function (node) {
|
||||
return node && /^(TH|TD)$/.test(node.nodeName);
|
||||
};
|
||||
var isListNode = function (editor) {
|
||||
return function (node) {
|
||||
return node && /^(OL|UL|DL)$/.test(node.nodeName) && isChildOfBody(editor, node);
|
||||
};
|
||||
};
|
||||
var getSelectedStyleType = function (editor) {
|
||||
var listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul');
|
||||
var style = editor.dom.getStyle(listElm, 'listStyleType');
|
||||
return Option.from(style);
|
||||
};
|
||||
var ListUtils = {
|
||||
isTableCellNode: isTableCellNode,
|
||||
isListNode: isListNode,
|
||||
getSelectedStyleType: getSelectedStyleType
|
||||
};
|
||||
|
||||
var findIndex = function (list, predicate) {
|
||||
for (var index = 0; index < list.length; index++) {
|
||||
var element = list[index];
|
||||
if (predicate(element)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
var styleValueToText = function (styleValue) {
|
||||
return styleValue.replace(/\-/g, ' ').replace(/\b\w/g, function (chr) {
|
||||
return chr.toUpperCase();
|
||||
});
|
||||
};
|
||||
var isWithinList = function (editor, e, nodeName) {
|
||||
var tableCellIndex = findIndex(e.parents, ListUtils.isTableCellNode);
|
||||
var parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;
|
||||
var lists = global$1.grep(parents, ListUtils.isListNode(editor));
|
||||
return lists.length > 0 && lists[0].nodeName === nodeName;
|
||||
};
|
||||
var addSplitButton = function (editor, id, tooltip, cmd, nodeName, styles) {
|
||||
editor.ui.registry.addSplitButton(id, {
|
||||
tooltip: tooltip,
|
||||
icon: nodeName === 'OL' ? 'ordered-list' : 'unordered-list',
|
||||
presets: 'listpreview',
|
||||
columns: 3,
|
||||
fetch: function (callback) {
|
||||
var items = global$1.map(styles, function (styleValue) {
|
||||
var iconStyle = nodeName === 'OL' ? 'num' : 'bull';
|
||||
var iconName = styleValue === 'disc' || styleValue === 'decimal' ? 'default' : styleValue;
|
||||
var itemValue = styleValue === 'default' ? '' : styleValue;
|
||||
var displayText = styleValueToText(styleValue);
|
||||
return {
|
||||
type: 'choiceitem',
|
||||
value: itemValue,
|
||||
icon: 'list-' + iconStyle + '-' + iconName,
|
||||
text: displayText
|
||||
};
|
||||
});
|
||||
callback(items);
|
||||
},
|
||||
onAction: function () {
|
||||
return editor.execCommand(cmd);
|
||||
},
|
||||
onItemAction: function (splitButtonApi, value) {
|
||||
Actions.applyListFormat(editor, nodeName, value);
|
||||
},
|
||||
select: function (value) {
|
||||
var listStyleType = ListUtils.getSelectedStyleType(editor);
|
||||
return listStyleType.map(function (listStyle) {
|
||||
return value === listStyle;
|
||||
}).getOr(false);
|
||||
},
|
||||
onSetup: function (api) {
|
||||
var nodeChangeHandler = function (e) {
|
||||
api.setActive(isWithinList(editor, e, nodeName));
|
||||
};
|
||||
editor.on('NodeChange', nodeChangeHandler);
|
||||
return function () {
|
||||
return editor.off('NodeChange', nodeChangeHandler);
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
var addButton = function (editor, id, tooltip, cmd, nodeName, styles) {
|
||||
editor.ui.registry.addToggleButton(id, {
|
||||
active: false,
|
||||
tooltip: tooltip,
|
||||
icon: nodeName === 'OL' ? 'ordered-list' : 'unordered-list',
|
||||
onSetup: function (api) {
|
||||
var nodeChangeHandler = function (e) {
|
||||
api.setActive(isWithinList(editor, e, nodeName));
|
||||
};
|
||||
editor.on('NodeChange', nodeChangeHandler);
|
||||
return function () {
|
||||
return editor.off('NodeChange', nodeChangeHandler);
|
||||
};
|
||||
},
|
||||
onAction: function () {
|
||||
return editor.execCommand(cmd);
|
||||
}
|
||||
});
|
||||
};
|
||||
var addControl = function (editor, id, tooltip, cmd, nodeName, styles) {
|
||||
if (styles.length > 0) {
|
||||
addSplitButton(editor, id, tooltip, cmd, nodeName, styles);
|
||||
} else {
|
||||
addButton(editor, id, tooltip, cmd, nodeName);
|
||||
}
|
||||
};
|
||||
var register$1 = function (editor) {
|
||||
addControl(editor, 'numlist', 'Numbered list', 'InsertOrderedList', 'OL', Settings.getNumberStyles(editor));
|
||||
addControl(editor, 'bullist', 'Bullet list', 'InsertUnorderedList', 'UL', Settings.getBulletStyles(editor));
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
function Plugin () {
|
||||
global.add('advlist', function (editor) {
|
||||
var hasPlugin = function (editor, plugin) {
|
||||
var plugins = editor.settings.plugins ? editor.settings.plugins : '';
|
||||
return global$1.inArray(plugins.split(/[ ,]/), plugin) !== -1;
|
||||
};
|
||||
if (hasPlugin(editor, 'lists')) {
|
||||
Buttons.register(editor);
|
||||
Commands.register(editor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";function n(){}function o(n){return function(){return n}}function t(){return d}var e,r=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=tinymce.util.Tools.resolve("tinymce.util.Tools"),l=function(n,t,e){var r="UL"===t?"InsertUnorderedList":"InsertOrderedList";n.execCommand(r,!1,!1===e?null:{"list-style-type":e})},i=function(e){e.addCommand("ApplyUnorderedListStyle",function(n,t){l(e,"UL",t["list-style-type"])}),e.addCommand("ApplyOrderedListStyle",function(n,t){l(e,"OL",t["list-style-type"])})},c=function(n){var t=n.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");return t?t.split(/[ ,]/):[]},s=function(n){var t=n.getParam("advlist_bullet_styles","default,circle,square");return t?t.split(/[ ,]/):[]},f=o(!1),a=o(!0),d=(e={fold:function(n,t){return n()},is:f,isSome:f,isNone:a,getOr:m,getOrThunk:p,getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:o(null),getOrUndefined:o(undefined),or:m,orThunk:p,map:t,each:n,bind:t,exists:f,forall:a,filter:t,equals:g,equals_:g,toArray:function(){return[]},toString:o("none()")},Object.freeze&&Object.freeze(e),e);function g(n){return n.isNone()}function p(n){return n()}function m(n){return n}function y(n,t,e){var r=function(n,t){for(var e=0;e<n.length;e++){if(t(n[e]))return e}return-1}(t.parents,L),i=-1!==r?t.parents.slice(0,r):t.parents,o=u.grep(i,N(n));return 0<o.length&&o[0].nodeName===e}function O(n,t,e,r,i,o){0<o.length?function(e,n,t,r,i,o){e.ui.registry.addSplitButton(n,{tooltip:t,icon:"OL"===i?"ordered-list":"unordered-list",presets:"listpreview",columns:3,fetch:function(n){n(u.map(o,function(n){return{type:"choiceitem",value:"default"===n?"":n,icon:"list-"+("OL"===i?"num":"bull")+"-"+("disc"===n||"decimal"===n?"default":n),text:function(n){return n.replace(/\-/g," ").replace(/\b\w/g,function(n){return n.toUpperCase()})}(n)}}))},onAction:function(){return e.execCommand(r)},onItemAction:function(n,t){l(e,i,t)},select:function(t){return S(e).map(function(n){return t===n}).getOr(!1)},onSetup:function(t){function n(n){t.setActive(y(e,n,i))}return e.on("NodeChange",n),function(){return e.off("NodeChange",n)}}})}(n,t,e,r,i,o):function(e,n,t,r,i){e.ui.registry.addToggleButton(n,{active:!1,tooltip:t,icon:"OL"===i?"ordered-list":"unordered-list",onSetup:function(t){function n(n){t.setActive(y(e,n,i))}return e.on("NodeChange",n),function(){return e.off("NodeChange",n)}},onAction:function(){return e.execCommand(r)}})}(n,t,e,r,i)}var v=function(e){function n(){return i}function t(n){return n(e)}var r=o(e),i={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:a,isNone:f,getOr:r,getOrThunk:r,getOrDie:r,getOrNull:r,getOrUndefined:r,or:n,orThunk:n,map:function(n){return v(n(e))},each:function(n){n(e)},bind:t,exists:t,forall:t,filter:function(n){return n(e)?i:d},toArray:function(){return[e]},toString:function(){return"some("+e+")"},equals:function(n){return n.is(e)},equals_:function(n,t){return n.fold(f,function(n){return t(e,n)})}};return i},h=function(n){return null===n||n===undefined?d:v(n)},L=function(n){return n&&/^(TH|TD)$/.test(n.nodeName)},N=function(t){return function(n){return n&&/^(OL|UL|DL)$/.test(n.nodeName)&&function(n,t){return n.$.contains(n.getBody(),t)}(t,n)}},S=function(n){var t=n.dom.getParent(n.selection.getNode(),"ol,ul"),e=n.dom.getStyle(t,"listStyleType");return h(e)},T=function(n){O(n,"numlist","Numbered list","InsertOrderedList","OL",c(n)),O(n,"bullist","Bullet list","InsertUnorderedList","UL",s(n))};!function b(){r.add("advlist",function(n){var t,e,r;e="lists",r=(t=n).settings.plugins?t.settings.plugins:"",-1!==u.inArray(r.split(/[ ,]/),e)&&(T(n),i(n))})}()}();
|
@ -0,0 +1,145 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var isValidId = function (id) {
|
||||
return /^[A-Za-z][A-Za-z0-9\-:._]*$/.test(id);
|
||||
};
|
||||
var getId = function (editor) {
|
||||
var selectedNode = editor.selection.getNode();
|
||||
var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
|
||||
return isAnchor ? selectedNode.getAttribute('id') || selectedNode.getAttribute('name') : '';
|
||||
};
|
||||
var insert = function (editor, id) {
|
||||
var selectedNode = editor.selection.getNode();
|
||||
var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
|
||||
if (isAnchor) {
|
||||
selectedNode.removeAttribute('name');
|
||||
selectedNode.id = id;
|
||||
editor.undoManager.add();
|
||||
} else {
|
||||
editor.focus();
|
||||
editor.selection.collapse(true);
|
||||
editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', { id: id }));
|
||||
}
|
||||
};
|
||||
var Anchor = {
|
||||
isValidId: isValidId,
|
||||
getId: getId,
|
||||
insert: insert
|
||||
};
|
||||
|
||||
var insertAnchor = function (editor, newId) {
|
||||
if (!Anchor.isValidId(newId)) {
|
||||
editor.windowManager.alert('Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.');
|
||||
return true;
|
||||
} else {
|
||||
Anchor.insert(editor, newId);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
var open = function (editor) {
|
||||
var currentId = Anchor.getId(editor);
|
||||
editor.windowManager.open({
|
||||
title: 'Anchor',
|
||||
size: 'normal',
|
||||
body: {
|
||||
type: 'panel',
|
||||
items: [{
|
||||
name: 'id',
|
||||
type: 'input',
|
||||
label: 'ID',
|
||||
placeholder: 'example'
|
||||
}]
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
type: 'cancel',
|
||||
name: 'cancel',
|
||||
text: 'Cancel'
|
||||
},
|
||||
{
|
||||
type: 'submit',
|
||||
name: 'save',
|
||||
text: 'Save',
|
||||
primary: true
|
||||
}
|
||||
],
|
||||
initialData: { id: currentId },
|
||||
onSubmit: function (api) {
|
||||
if (!insertAnchor(editor, api.getData().id)) {
|
||||
api.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
var Dialog = { open: open };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceAnchor', function () {
|
||||
Dialog.open(editor);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var isAnchorNode = function (node) {
|
||||
return !node.attr('href') && (node.attr('id') || node.attr('name')) && !node.firstChild;
|
||||
};
|
||||
var setContentEditable = function (state) {
|
||||
return function (nodes) {
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
if (isAnchorNode(nodes[i])) {
|
||||
nodes[i].attr('contenteditable', state);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
var setup = function (editor) {
|
||||
editor.on('PreInit', function () {
|
||||
editor.parser.addNodeFilter('a', setContentEditable('false'));
|
||||
editor.serializer.addNodeFilter('a', setContentEditable(null));
|
||||
});
|
||||
};
|
||||
var FilterContent = { setup: setup };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.ui.registry.addToggleButton('anchor', {
|
||||
icon: 'bookmark',
|
||||
tooltip: 'Anchor',
|
||||
onAction: function () {
|
||||
return editor.execCommand('mceAnchor');
|
||||
},
|
||||
onSetup: function (buttonApi) {
|
||||
return editor.selection.selectorChangedWithUnbind('a:not([href])', buttonApi.setActive).unbind;
|
||||
}
|
||||
});
|
||||
editor.ui.registry.addMenuItem('anchor', {
|
||||
icon: 'bookmark',
|
||||
text: 'Anchor...',
|
||||
onAction: function () {
|
||||
return editor.execCommand('mceAnchor');
|
||||
}
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
function Plugin () {
|
||||
global.add('anchor', function (editor) {
|
||||
FilterContent.setup(editor);
|
||||
Commands.register(editor);
|
||||
Buttons.register(editor);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";function e(o){return function(t){for(var e=0;e<t.length;e++)(n=t[e]).attr("href")||!n.attr("id")&&!n.attr("name")||n.firstChild||t[e].attr("contenteditable",o);var n}}var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=function(t){return/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(t)},o=function(t){var e=t.selection.getNode();return"A"===e.tagName&&""===t.dom.getAttrib(e,"href")?e.getAttribute("id")||e.getAttribute("name"):""},r=function(t,e){var n=t.selection.getNode();"A"===n.tagName&&""===t.dom.getAttrib(n,"href")?(n.removeAttribute("name"),n.id=e,t.undoManager.add()):(t.focus(),t.selection.collapse(!0),t.execCommand("mceInsertContent",!1,t.dom.createHTML("a",{id:e})))},a=function(e){var t=o(e);e.windowManager.open({title:"Anchor",size:"normal",body:{type:"panel",items:[{name:"id",type:"input",label:"ID",placeholder:"example"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{id:t},onSubmit:function(t){!function(t,e){return n(e)?(r(t,e),!1):(t.windowManager.alert("Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),!0)}(e,t.getData().id)&&t.close()}})},i=function(t){t.addCommand("mceAnchor",function(){a(t)})},c=function(t){t.on("PreInit",function(){t.parser.addNodeFilter("a",e("false")),t.serializer.addNodeFilter("a",e(null))})},d=function(e){e.ui.registry.addToggleButton("anchor",{icon:"bookmark",tooltip:"Anchor",onAction:function(){return e.execCommand("mceAnchor")},onSetup:function(t){return e.selection.selectorChangedWithUnbind("a:not([href])",t.setActive).unbind}}),e.ui.registry.addMenuItem("anchor",{icon:"bookmark",text:"Anchor...",onAction:function(){return e.execCommand("mceAnchor")}})};!function u(){t.add("anchor",function(t){c(t),i(t),d(t)})}()}();
|
@ -0,0 +1,191 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var getAutoLinkPattern = function (editor) {
|
||||
return editor.getParam('autolink_pattern', /^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i);
|
||||
};
|
||||
var getDefaultLinkTarget = function (editor) {
|
||||
return editor.getParam('default_link_target', false);
|
||||
};
|
||||
var getDefaultLinkProtocol = function (editor) {
|
||||
return editor.getParam('link_default_protocol', 'http', 'string');
|
||||
};
|
||||
var Settings = {
|
||||
getAutoLinkPattern: getAutoLinkPattern,
|
||||
getDefaultLinkTarget: getDefaultLinkTarget,
|
||||
getDefaultLinkProtocol: getDefaultLinkProtocol
|
||||
};
|
||||
|
||||
var rangeEqualsDelimiterOrSpace = function (rangeString, delimiter) {
|
||||
return rangeString === delimiter || rangeString === ' ' || rangeString.charCodeAt(0) === 160;
|
||||
};
|
||||
var handleEclipse = function (editor) {
|
||||
parseCurrentLine(editor, -1, '(');
|
||||
};
|
||||
var handleSpacebar = function (editor) {
|
||||
parseCurrentLine(editor, 0, '');
|
||||
};
|
||||
var handleEnter = function (editor) {
|
||||
parseCurrentLine(editor, -1, '');
|
||||
};
|
||||
var scopeIndex = function (container, index) {
|
||||
if (index < 0) {
|
||||
index = 0;
|
||||
}
|
||||
if (container.nodeType === 3) {
|
||||
var len = container.data.length;
|
||||
if (index > len) {
|
||||
index = len;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
};
|
||||
var setStart = function (rng, container, offset) {
|
||||
if (container.nodeType !== 1 || container.hasChildNodes()) {
|
||||
rng.setStart(container, scopeIndex(container, offset));
|
||||
} else {
|
||||
rng.setStartBefore(container);
|
||||
}
|
||||
};
|
||||
var setEnd = function (rng, container, offset) {
|
||||
if (container.nodeType !== 1 || container.hasChildNodes()) {
|
||||
rng.setEnd(container, scopeIndex(container, offset));
|
||||
} else {
|
||||
rng.setEndAfter(container);
|
||||
}
|
||||
};
|
||||
var parseCurrentLine = function (editor, endOffset, delimiter) {
|
||||
var rng, end, start, endContainer, bookmark, text, matches, prev, len, rngText;
|
||||
var autoLinkPattern = Settings.getAutoLinkPattern(editor);
|
||||
var defaultLinkTarget = Settings.getDefaultLinkTarget(editor);
|
||||
if (editor.selection.getNode().tagName === 'A') {
|
||||
return;
|
||||
}
|
||||
rng = editor.selection.getRng(true).cloneRange();
|
||||
if (rng.startOffset < 5) {
|
||||
prev = rng.endContainer.previousSibling;
|
||||
if (!prev) {
|
||||
if (!rng.endContainer.firstChild || !rng.endContainer.firstChild.nextSibling) {
|
||||
return;
|
||||
}
|
||||
prev = rng.endContainer.firstChild.nextSibling;
|
||||
}
|
||||
len = prev.length;
|
||||
setStart(rng, prev, len);
|
||||
setEnd(rng, prev, len);
|
||||
if (rng.endOffset < 5) {
|
||||
return;
|
||||
}
|
||||
end = rng.endOffset;
|
||||
endContainer = prev;
|
||||
} else {
|
||||
endContainer = rng.endContainer;
|
||||
if (endContainer.nodeType !== 3 && endContainer.firstChild) {
|
||||
while (endContainer.nodeType !== 3 && endContainer.firstChild) {
|
||||
endContainer = endContainer.firstChild;
|
||||
}
|
||||
if (endContainer.nodeType === 3) {
|
||||
setStart(rng, endContainer, 0);
|
||||
setEnd(rng, endContainer, endContainer.nodeValue.length);
|
||||
}
|
||||
}
|
||||
if (rng.endOffset === 1) {
|
||||
end = 2;
|
||||
} else {
|
||||
end = rng.endOffset - 1 - endOffset;
|
||||
}
|
||||
}
|
||||
start = end;
|
||||
do {
|
||||
setStart(rng, endContainer, end >= 2 ? end - 2 : 0);
|
||||
setEnd(rng, endContainer, end >= 1 ? end - 1 : 0);
|
||||
end -= 1;
|
||||
rngText = rng.toString();
|
||||
} while (rngText !== ' ' && rngText !== '' && rngText.charCodeAt(0) !== 160 && end - 2 >= 0 && rngText !== delimiter);
|
||||
if (rangeEqualsDelimiterOrSpace(rng.toString(), delimiter)) {
|
||||
setStart(rng, endContainer, end);
|
||||
setEnd(rng, endContainer, start);
|
||||
end += 1;
|
||||
} else if (rng.startOffset === 0) {
|
||||
setStart(rng, endContainer, 0);
|
||||
setEnd(rng, endContainer, start);
|
||||
} else {
|
||||
setStart(rng, endContainer, end);
|
||||
setEnd(rng, endContainer, start);
|
||||
}
|
||||
text = rng.toString();
|
||||
if (text.charAt(text.length - 1) === '.') {
|
||||
setEnd(rng, endContainer, start - 1);
|
||||
}
|
||||
text = rng.toString().trim();
|
||||
matches = text.match(autoLinkPattern);
|
||||
var protocol = Settings.getDefaultLinkProtocol(editor);
|
||||
if (matches) {
|
||||
if (matches[1] === 'www.') {
|
||||
matches[1] = protocol + '://www.';
|
||||
} else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) {
|
||||
matches[1] = 'mailto:' + matches[1];
|
||||
}
|
||||
bookmark = editor.selection.getBookmark();
|
||||
editor.selection.setRng(rng);
|
||||
editor.execCommand('createlink', false, matches[1] + matches[2]);
|
||||
if (defaultLinkTarget !== false) {
|
||||
editor.dom.setAttrib(editor.selection.getNode(), 'target', defaultLinkTarget);
|
||||
}
|
||||
editor.selection.moveToBookmark(bookmark);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
};
|
||||
var setup = function (editor) {
|
||||
var autoUrlDetectState;
|
||||
editor.on('keydown', function (e) {
|
||||
if (e.keyCode === 13) {
|
||||
return handleEnter(editor);
|
||||
}
|
||||
});
|
||||
if (global$1.browser.isIE()) {
|
||||
editor.on('focus', function () {
|
||||
if (!autoUrlDetectState) {
|
||||
autoUrlDetectState = true;
|
||||
try {
|
||||
editor.execCommand('AutoUrlDetect', false, true);
|
||||
} catch (ex) {
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
editor.on('keypress', function (e) {
|
||||
if (e.keyCode === 41) {
|
||||
return handleEclipse(editor);
|
||||
}
|
||||
});
|
||||
editor.on('keyup', function (e) {
|
||||
if (e.keyCode === 32) {
|
||||
return handleSpacebar(editor);
|
||||
}
|
||||
});
|
||||
};
|
||||
var Keys = { setup: setup };
|
||||
|
||||
function Plugin () {
|
||||
global.add('autolink', function (editor) {
|
||||
Keys.setup(editor);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";function i(t,e){if(e<0&&(e=0),3===t.nodeType){var n=t.data.length;n<e&&(e=n)}return e}function C(t,e,n){1!==e.nodeType||e.hasChildNodes()?t.setStart(e,i(e,n)):t.setStartBefore(e)}function y(t,e,n){1!==e.nodeType||e.hasChildNodes()?t.setEnd(e,i(e,n)):t.setEndAfter(e)}var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=tinymce.util.Tools.resolve("tinymce.Env"),k=function(t){return t.getParam("autolink_pattern",/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i)},p=function(t){return t.getParam("default_link_target",!1)},w=function(t){return t.getParam("link_default_protocol","http","string")},r=function(t,e,n){var i,o,r,f,a,s,d,l,c,u,g=k(t),h=p(t);if("A"!==t.selection.getNode().tagName){if((i=t.selection.getRng(!0).cloneRange()).startOffset<5){if(!(l=i.endContainer.previousSibling)){if(!i.endContainer.firstChild||!i.endContainer.firstChild.nextSibling)return;l=i.endContainer.firstChild.nextSibling}if(c=l.length,C(i,l,c),y(i,l,c),i.endOffset<5)return;o=i.endOffset,f=l}else{if(3!==(f=i.endContainer).nodeType&&f.firstChild){for(;3!==f.nodeType&&f.firstChild;)f=f.firstChild;3===f.nodeType&&(C(i,f,0),y(i,f,f.nodeValue.length))}o=1===i.endOffset?2:i.endOffset-1-e}for(r=o;C(i,f,2<=o?o-2:0),y(i,f,1<=o?o-1:0),o-=1," "!==(u=i.toString())&&""!==u&&160!==u.charCodeAt(0)&&0<=o-2&&u!==n;);!function(t,e){return t===e||" "===t||160===t.charCodeAt(0)}(i.toString(),n)?(0===i.startOffset?C(i,f,0):C(i,f,o),y(i,f,r)):(C(i,f,o),y(i,f,r),o+=1),"."===(s=i.toString()).charAt(s.length-1)&&y(i,f,r-1),d=(s=i.toString().trim()).match(g);var m=w(t);d&&("www."===d[1]?d[1]=m+"://www.":/@$/.test(d[1])&&!/^mailto:/.test(d[1])&&(d[1]="mailto:"+d[1]),a=t.selection.getBookmark(),t.selection.setRng(i),t.execCommand("createlink",!1,d[1]+d[2]),!1!==h&&t.dom.setAttrib(t.selection.getNode(),"target",h),t.selection.moveToBookmark(a),t.nodeChanged())}},e=function(e){var n;e.on("keydown",function(t){if(13===t.keyCode)return function(t){r(t,-1,"")}(e)}),o.browser.isIE()?e.on("focus",function(){if(!n){n=!0;try{e.execCommand("AutoUrlDetect",!1,!0)}catch(t){}}}):(e.on("keypress",function(t){if(41===t.keyCode)return function(t){r(t,-1,"(")}(e)}),e.on("keyup",function(t){if(32===t.keyCode)return function(t){r(t,0,"")}(e)}))};!function n(){t.add("autolink",function(t){e(t)})}()}();
|
@ -0,0 +1,188 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
||||
|
||||
var fireResizeEditor = function (editor) {
|
||||
return editor.fire('ResizeEditor');
|
||||
};
|
||||
var Events = { fireResizeEditor: fireResizeEditor };
|
||||
|
||||
var getAutoResizeMinHeight = function (editor) {
|
||||
return editor.getParam('min_height', editor.getElement().offsetHeight, 'number');
|
||||
};
|
||||
var getAutoResizeMaxHeight = function (editor) {
|
||||
return editor.getParam('max_height', 0, 'number');
|
||||
};
|
||||
var getAutoResizeOverflowPadding = function (editor) {
|
||||
return editor.getParam('autoresize_overflow_padding', 1, 'number');
|
||||
};
|
||||
var getAutoResizeBottomMargin = function (editor) {
|
||||
return editor.getParam('autoresize_bottom_margin', 50, 'number');
|
||||
};
|
||||
var shouldAutoResizeOnInit = function (editor) {
|
||||
return editor.getParam('autoresize_on_init', true, 'boolean');
|
||||
};
|
||||
var Settings = {
|
||||
getAutoResizeMinHeight: getAutoResizeMinHeight,
|
||||
getAutoResizeMaxHeight: getAutoResizeMaxHeight,
|
||||
getAutoResizeOverflowPadding: getAutoResizeOverflowPadding,
|
||||
getAutoResizeBottomMargin: getAutoResizeBottomMargin,
|
||||
shouldAutoResizeOnInit: shouldAutoResizeOnInit
|
||||
};
|
||||
|
||||
var isFullscreen = function (editor) {
|
||||
return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();
|
||||
};
|
||||
var wait = function (editor, oldSize, times, interval, callback) {
|
||||
global$2.setEditorTimeout(editor, function () {
|
||||
resize(editor, oldSize);
|
||||
if (times--) {
|
||||
wait(editor, oldSize, times, interval, callback);
|
||||
} else if (callback) {
|
||||
callback();
|
||||
}
|
||||
}, interval);
|
||||
};
|
||||
var toggleScrolling = function (editor, state) {
|
||||
var body = editor.getBody();
|
||||
if (body) {
|
||||
body.style.overflowY = state ? '' : 'hidden';
|
||||
if (!state) {
|
||||
body.scrollTop = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
var parseCssValueToInt = function (dom, elm, name, computed) {
|
||||
var value = parseInt(dom.getStyle(elm, name, computed), 10);
|
||||
return isNaN(value) ? 0 : value;
|
||||
};
|
||||
var resize = function (editor, oldSize) {
|
||||
var deltaSize, resizeHeight, contentHeight;
|
||||
var dom = editor.dom;
|
||||
var doc = editor.getDoc();
|
||||
if (!doc) {
|
||||
return;
|
||||
}
|
||||
if (isFullscreen(editor)) {
|
||||
toggleScrolling(editor, true);
|
||||
return;
|
||||
}
|
||||
var docEle = doc.documentElement;
|
||||
var resizeBottomMargin = Settings.getAutoResizeBottomMargin(editor);
|
||||
resizeHeight = Settings.getAutoResizeMinHeight(editor);
|
||||
var marginTop = parseCssValueToInt(dom, docEle, 'margin-top', true);
|
||||
var marginBottom = parseCssValueToInt(dom, docEle, 'margin-bottom', true);
|
||||
contentHeight = docEle.offsetHeight + marginTop + marginBottom + resizeBottomMargin;
|
||||
if (contentHeight < 0) {
|
||||
contentHeight = 0;
|
||||
}
|
||||
var containerHeight = editor.getContainer().offsetHeight;
|
||||
var contentAreaHeight = editor.getContentAreaContainer().offsetHeight;
|
||||
var chromeHeight = containerHeight - contentAreaHeight;
|
||||
if (contentHeight + chromeHeight > Settings.getAutoResizeMinHeight(editor)) {
|
||||
resizeHeight = contentHeight + chromeHeight;
|
||||
}
|
||||
var maxHeight = Settings.getAutoResizeMaxHeight(editor);
|
||||
if (maxHeight && resizeHeight > maxHeight) {
|
||||
resizeHeight = maxHeight;
|
||||
toggleScrolling(editor, true);
|
||||
} else {
|
||||
toggleScrolling(editor, false);
|
||||
}
|
||||
if (resizeHeight !== oldSize.get()) {
|
||||
deltaSize = resizeHeight - oldSize.get();
|
||||
dom.setStyle(editor.getContainer(), 'height', resizeHeight + 'px');
|
||||
oldSize.set(resizeHeight);
|
||||
Events.fireResizeEditor(editor);
|
||||
if (global$1.browser.isSafari() && global$1.mac) {
|
||||
var win = editor.getWin();
|
||||
win.scrollTo(win.pageXOffset, win.pageYOffset);
|
||||
}
|
||||
if (editor.hasFocus()) {
|
||||
editor.selection.scrollIntoView(editor.selection.getNode());
|
||||
}
|
||||
if (global$1.webkit && deltaSize < 0) {
|
||||
resize(editor, oldSize);
|
||||
}
|
||||
}
|
||||
};
|
||||
var setup = function (editor, oldSize) {
|
||||
editor.on('init', function () {
|
||||
var overflowPadding = Settings.getAutoResizeOverflowPadding(editor);
|
||||
var dom = editor.dom;
|
||||
dom.setStyles(editor.getBody(), {
|
||||
'paddingLeft': overflowPadding,
|
||||
'paddingRight': overflowPadding,
|
||||
'min-height': 0
|
||||
});
|
||||
});
|
||||
editor.on('NodeChange SetContent keyup FullscreenStateChanged ResizeContent', function () {
|
||||
resize(editor, oldSize);
|
||||
});
|
||||
if (Settings.shouldAutoResizeOnInit(editor)) {
|
||||
editor.on('init', function () {
|
||||
wait(editor, oldSize, 20, 100, function () {
|
||||
wait(editor, oldSize, 5, 1000);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
var Resize = {
|
||||
setup: setup,
|
||||
resize: resize
|
||||
};
|
||||
|
||||
var register = function (editor, oldSize) {
|
||||
editor.addCommand('mceAutoResize', function () {
|
||||
Resize.resize(editor, oldSize);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
function Plugin () {
|
||||
global.add('autoresize', function (editor) {
|
||||
if (!editor.settings.hasOwnProperty('resize')) {
|
||||
editor.settings.resize = false;
|
||||
}
|
||||
if (!editor.inline) {
|
||||
var oldSize = Cell(0);
|
||||
Commands.register(editor, oldSize);
|
||||
Resize.setup(editor, oldSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";function d(e,t){var n=e.getBody();n&&(n.style.overflowY=t?"":"hidden",t||(n.scrollTop=0))}function h(e,t,n,i){var o=parseInt(e.getStyle(t,n,i),10);return isNaN(o)?0:o}var i=function(e){function t(){return n}var n=e;return{get:t,set:function(e){n=e},clone:function(){return i(t())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),v=tinymce.util.Tools.resolve("tinymce.Env"),r=tinymce.util.Tools.resolve("tinymce.util.Delay"),p=function(e){return e.fire("ResizeEditor")},y=function(e){return e.getParam("min_height",e.getElement().offsetHeight,"number")},z=function(e){return e.getParam("max_height",0,"number")},n=function(e){return e.getParam("autoresize_overflow_padding",1,"number")},b=function(e){return e.getParam("autoresize_bottom_margin",50,"number")},o=function(e){return e.getParam("autoresize_on_init",!0,"boolean")},u=function(e,t,n,i,o){r.setEditorTimeout(e,function(){C(e,t),n--?u(e,t,n,i,o):o&&o()},i)},C=function(e,t){var n,i,o,r=e.dom,u=e.getDoc();if(u)if(function(e){return e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen()}(e))d(e,!0);else{var s=u.documentElement,a=b(e);i=y(e);var f=h(r,s,"margin-top",!0),c=h(r,s,"margin-bottom",!0);(o=s.offsetHeight+f+c+a)<0&&(o=0);var g=e.getContainer().offsetHeight-e.getContentAreaContainer().offsetHeight;o+g>y(e)&&(i=o+g);var l=z(e);if(l&&l<i?(i=l,d(e,!0)):d(e,!1),i!==t.get()){if(n=i-t.get(),r.setStyle(e.getContainer(),"height",i+"px"),t.set(i),p(e),v.browser.isSafari()&&v.mac){var m=e.getWin();m.scrollTo(m.pageXOffset,m.pageYOffset)}e.hasFocus()&&e.selection.scrollIntoView(e.selection.getNode()),v.webkit&&n<0&&C(e,t)}}},s={setup:function(t,e){t.on("init",function(){var e=n(t);t.dom.setStyles(t.getBody(),{paddingLeft:e,paddingRight:e,"min-height":0})}),t.on("NodeChange SetContent keyup FullscreenStateChanged ResizeContent",function(){C(t,e)}),o(t)&&t.on("init",function(){u(t,e,20,100,function(){u(t,e,5,1e3)})})},resize:C},a=function(e,t){e.addCommand("mceAutoResize",function(){s.resize(e,t)})};!function t(){e.add("autoresize",function(e){if(e.settings.hasOwnProperty("resize")||(e.settings.resize=!1),!e.inline){var t=i(0);a(e,t),s.setup(e,t)}})}()}();
|
@ -0,0 +1,230 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function (domGlobals) {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.util.LocalStorage');
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var fireRestoreDraft = function (editor) {
|
||||
return editor.fire('RestoreDraft');
|
||||
};
|
||||
var fireStoreDraft = function (editor) {
|
||||
return editor.fire('StoreDraft');
|
||||
};
|
||||
var fireRemoveDraft = function (editor) {
|
||||
return editor.fire('RemoveDraft');
|
||||
};
|
||||
|
||||
var parse = function (timeString, defaultTime) {
|
||||
var multiples = {
|
||||
s: 1000,
|
||||
m: 60000
|
||||
};
|
||||
var toParse = timeString || defaultTime;
|
||||
var parsedTime = /^(\d+)([ms]?)$/.exec('' + toParse);
|
||||
return (parsedTime[2] ? multiples[parsedTime[2]] : 1) * parseInt(toParse, 10);
|
||||
};
|
||||
|
||||
var shouldAskBeforeUnload = function (editor) {
|
||||
return editor.getParam('autosave_ask_before_unload', true);
|
||||
};
|
||||
var getAutoSavePrefix = function (editor) {
|
||||
var prefix = editor.getParam('autosave_prefix', 'tinymce-autosave-{path}{query}{hash}-{id}-');
|
||||
prefix = prefix.replace(/\{path\}/g, domGlobals.document.location.pathname);
|
||||
prefix = prefix.replace(/\{query\}/g, domGlobals.document.location.search);
|
||||
prefix = prefix.replace(/\{hash\}/g, domGlobals.document.location.hash);
|
||||
prefix = prefix.replace(/\{id\}/g, editor.id);
|
||||
return prefix;
|
||||
};
|
||||
var shouldRestoreWhenEmpty = function (editor) {
|
||||
return editor.getParam('autosave_restore_when_empty', false);
|
||||
};
|
||||
var getAutoSaveInterval = function (editor) {
|
||||
return parse(editor.settings.autosave_interval, '30s');
|
||||
};
|
||||
var getAutoSaveRetention = function (editor) {
|
||||
return parse(editor.settings.autosave_retention, '20m');
|
||||
};
|
||||
|
||||
var isEmpty = function (editor, html) {
|
||||
var forcedRootBlockName = editor.settings.forced_root_block;
|
||||
html = global$3.trim(typeof html === 'undefined' ? editor.getBody().innerHTML : html);
|
||||
return html === '' || new RegExp('^<' + forcedRootBlockName + '[^>]*>((\xA0| |[ \t]|<br[^>]*>)+?|)</' + forcedRootBlockName + '>|<br>$', 'i').test(html);
|
||||
};
|
||||
var hasDraft = function (editor) {
|
||||
var time = parseInt(global$2.getItem(getAutoSavePrefix(editor) + 'time'), 10) || 0;
|
||||
if (new Date().getTime() - time > getAutoSaveRetention(editor)) {
|
||||
removeDraft(editor, false);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
var removeDraft = function (editor, fire) {
|
||||
var prefix = getAutoSavePrefix(editor);
|
||||
global$2.removeItem(prefix + 'draft');
|
||||
global$2.removeItem(prefix + 'time');
|
||||
if (fire !== false) {
|
||||
fireRemoveDraft(editor);
|
||||
}
|
||||
};
|
||||
var storeDraft = function (editor) {
|
||||
var prefix = getAutoSavePrefix(editor);
|
||||
if (!isEmpty(editor) && editor.isDirty()) {
|
||||
global$2.setItem(prefix + 'draft', editor.getContent({
|
||||
format: 'raw',
|
||||
no_events: true
|
||||
}));
|
||||
global$2.setItem(prefix + 'time', new Date().getTime().toString());
|
||||
fireStoreDraft(editor);
|
||||
}
|
||||
};
|
||||
var restoreDraft = function (editor) {
|
||||
var prefix = getAutoSavePrefix(editor);
|
||||
if (hasDraft(editor)) {
|
||||
editor.setContent(global$2.getItem(prefix + 'draft'), { format: 'raw' });
|
||||
fireRestoreDraft(editor);
|
||||
}
|
||||
};
|
||||
var startStoreDraft = function (editor, started) {
|
||||
var interval = getAutoSaveInterval(editor);
|
||||
if (!started.get()) {
|
||||
global$1.setInterval(function () {
|
||||
if (!editor.removed) {
|
||||
storeDraft(editor);
|
||||
}
|
||||
}, interval);
|
||||
started.set(true);
|
||||
}
|
||||
};
|
||||
var restoreLastDraft = function (editor) {
|
||||
editor.undoManager.transact(function () {
|
||||
restoreDraft(editor);
|
||||
removeDraft(editor);
|
||||
});
|
||||
editor.focus();
|
||||
};
|
||||
|
||||
function curry(fn) {
|
||||
var initialArgs = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
initialArgs[_i - 1] = arguments[_i];
|
||||
}
|
||||
return function () {
|
||||
var restArgs = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
restArgs[_i] = arguments[_i];
|
||||
}
|
||||
var all = initialArgs.concat(restArgs);
|
||||
return fn.apply(null, all);
|
||||
};
|
||||
}
|
||||
|
||||
var get = function (editor) {
|
||||
return {
|
||||
hasDraft: curry(hasDraft, editor),
|
||||
storeDraft: curry(storeDraft, editor),
|
||||
restoreDraft: curry(restoreDraft, editor),
|
||||
removeDraft: curry(removeDraft, editor),
|
||||
isEmpty: curry(isEmpty, editor)
|
||||
};
|
||||
};
|
||||
|
||||
var global$4 = tinymce.util.Tools.resolve('tinymce.EditorManager');
|
||||
|
||||
var setup = function (editor) {
|
||||
editor.editorManager.on('BeforeUnload', function (e) {
|
||||
var msg;
|
||||
global$3.each(global$4.get(), function (editor) {
|
||||
if (editor.plugins.autosave) {
|
||||
editor.plugins.autosave.storeDraft();
|
||||
}
|
||||
if (!msg && editor.isDirty() && shouldAskBeforeUnload(editor)) {
|
||||
msg = editor.translate('You have unsaved changes are you sure you want to navigate away?');
|
||||
}
|
||||
});
|
||||
if (msg) {
|
||||
e.preventDefault();
|
||||
e.returnValue = msg;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var makeSetupHandler = function (editor, started) {
|
||||
return function (api) {
|
||||
api.setDisabled(!hasDraft(editor));
|
||||
var editorEventCallback = function () {
|
||||
return api.setDisabled(!hasDraft(editor));
|
||||
};
|
||||
editor.on('StoreDraft RestoreDraft RemoveDraft', editorEventCallback);
|
||||
return function () {
|
||||
return editor.off('StoreDraft RestoreDraft RemoveDraft', editorEventCallback);
|
||||
};
|
||||
};
|
||||
};
|
||||
var register = function (editor, started) {
|
||||
startStoreDraft(editor, started);
|
||||
editor.ui.registry.addButton('restoredraft', {
|
||||
tooltip: 'Restore last draft',
|
||||
icon: 'restore-draft',
|
||||
onAction: function () {
|
||||
restoreLastDraft(editor);
|
||||
},
|
||||
onSetup: makeSetupHandler(editor)
|
||||
});
|
||||
editor.ui.registry.addMenuItem('restoredraft', {
|
||||
text: 'Restore last draft',
|
||||
icon: 'restore-draft',
|
||||
onAction: function () {
|
||||
restoreLastDraft(editor);
|
||||
},
|
||||
onSetup: makeSetupHandler(editor)
|
||||
});
|
||||
};
|
||||
|
||||
function Plugin () {
|
||||
global.add('autosave', function (editor) {
|
||||
var started = Cell(false);
|
||||
setup(editor);
|
||||
register(editor, started);
|
||||
editor.on('init', function () {
|
||||
if (shouldRestoreWhenEmpty(editor) && editor.dom.isEmpty(editor.getBody())) {
|
||||
restoreDraft(editor);
|
||||
}
|
||||
});
|
||||
return get(editor);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}(window));
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(n){"use strict";function r(t,e){var n=t||e,r=/^(\d+)([ms]?)$/.exec(""+n);return(r[2]?{s:1e3,m:6e4}[r[2]]:1)*parseInt(n,10)}function o(t){var e=t.getParam("autosave_prefix","tinymce-autosave-{path}{query}{hash}-{id}-");return e=(e=(e=(e=e.replace(/\{path\}/g,n.document.location.pathname)).replace(/\{query\}/g,n.document.location.search)).replace(/\{hash\}/g,n.document.location.hash)).replace(/\{id\}/g,t.id)}function a(t,e){var n=t.settings.forced_root_block;return""===(e=d.trim(void 0===e?t.getBody().innerHTML:e))||new RegExp("^<"+n+"[^>]*>((\xa0| |[ \t]|<br[^>]*>)+?|)</"+n+">|<br>$","i").test(e)}function i(t){var e=parseInt(v.getItem(o(t)+"time"),10)||0;return!((new Date).getTime()-e>function(t){return r(t.settings.autosave_retention,"20m")}(t))||(g(t,!1),!1)}function u(t){var e=o(t);!a(t)&&t.isDirty()&&(v.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),v.setItem(e+"time",(new Date).getTime().toString()),function(t){t.fire("StoreDraft")}(t))}function s(t){var e=o(t);i(t)&&(t.setContent(v.getItem(e+"draft"),{format:"raw"}),function(t){t.fire("RestoreDraft")}(t))}function c(t,e){var n=function(t){return r(t.settings.autosave_interval,"30s")}(t);e.get()||(m.setInterval(function(){t.removed||u(t)},n),e.set(!0))}function f(t){t.undoManager.transact(function(){s(t),g(t)}),t.focus()}var l=function(t){function e(){return n}var n=t;return{get:e,set:function(t){n=t},clone:function(){return l(e())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),m=tinymce.util.Tools.resolve("tinymce.util.Delay"),v=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),d=tinymce.util.Tools.resolve("tinymce.util.Tools"),g=function(t,e){var n=o(t);v.removeItem(n+"draft"),v.removeItem(n+"time"),!1!==e&&function(t){t.fire("RemoveDraft")}(t)};function y(r){for(var o=[],t=1;t<arguments.length;t++)o[t-1]=arguments[t];return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=o.concat(t);return r.apply(null,n)}}function p(n,t){return function(t){t.setDisabled(!i(n));function e(){return t.setDisabled(!i(n))}return n.on("StoreDraft RestoreDraft RemoveDraft",e),function(){return n.off("StoreDraft RestoreDraft RemoveDraft",e)}}}var D=tinymce.util.Tools.resolve("tinymce.EditorManager");!function e(){t.add("autosave",function(t){var e=l(!1);return function(t){t.editorManager.on("BeforeUnload",function(t){var e;d.each(D.get(),function(t){t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&function(t){return t.getParam("autosave_ask_before_unload",!0)}(t)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))}),e&&(t.preventDefault(),t.returnValue=e)})}(t),function(t,e){c(t,e),t.ui.registry.addButton("restoredraft",{tooltip:"Restore last draft",icon:"restore-draft",onAction:function(){f(t)},onSetup:p(t)}),t.ui.registry.addMenuItem("restoredraft",{text:"Restore last draft",icon:"restore-draft",onAction:function(){f(t)},onSetup:p(t)})}(t,e),t.on("init",function(){(function(t){return t.getParam("autosave_restore_when_empty",!1)})(t)&&t.dom.isEmpty(t.getBody())&&s(t)}),function(t){return{hasDraft:y(i,t),storeDraft:y(u,t),restoreDraft:y(s,t),removeDraft:y(g,t),isEmpty:y(a,t)}}(t)})}()}(window);
|
@ -0,0 +1,103 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var html2bbcode = function (s) {
|
||||
s = global$1.trim(s);
|
||||
var rep = function (re, str) {
|
||||
s = s.replace(re, str);
|
||||
};
|
||||
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi, '[url=$1]$2[/url]');
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]');
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]');
|
||||
rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]');
|
||||
rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]');
|
||||
rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi, '[color=$1]$2[/color]');
|
||||
rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[color=$1]$2[/color]');
|
||||
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi, '[size=$1]$2[/size]');
|
||||
rep(/<font>(.*?)<\/font>/gi, '$1');
|
||||
rep(/<img.*?src=\"(.*?)\".*?\/>/gi, '[img]$1[/img]');
|
||||
rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi, '[code]$1[/code]');
|
||||
rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi, '[quote]$1[/quote]');
|
||||
rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi, '[code][b]$1[/b][/code]');
|
||||
rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi, '[quote][b]$1[/b][/quote]');
|
||||
rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi, '[code][i]$1[/i][/code]');
|
||||
rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi, '[quote][i]$1[/i][/quote]');
|
||||
rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi, '[code][u]$1[/u][/code]');
|
||||
rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi, '[quote][u]$1[/u][/quote]');
|
||||
rep(/<\/(strong|b)>/gi, '[/b]');
|
||||
rep(/<(strong|b)>/gi, '[b]');
|
||||
rep(/<\/(em|i)>/gi, '[/i]');
|
||||
rep(/<(em|i)>/gi, '[i]');
|
||||
rep(/<\/u>/gi, '[/u]');
|
||||
rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi, '[u]$1[/u]');
|
||||
rep(/<u>/gi, '[u]');
|
||||
rep(/<blockquote[^>]*>/gi, '[quote]');
|
||||
rep(/<\/blockquote>/gi, '[/quote]');
|
||||
rep(/<br \/>/gi, '\n');
|
||||
rep(/<br\/>/gi, '\n');
|
||||
rep(/<br>/gi, '\n');
|
||||
rep(/<p>/gi, '');
|
||||
rep(/<\/p>/gi, '\n');
|
||||
rep(/ |\u00a0/gi, ' ');
|
||||
rep(/"/gi, '"');
|
||||
rep(/</gi, '<');
|
||||
rep(/>/gi, '>');
|
||||
rep(/&/gi, '&');
|
||||
return s;
|
||||
};
|
||||
var bbcode2html = function (s) {
|
||||
s = global$1.trim(s);
|
||||
var rep = function (re, str) {
|
||||
s = s.replace(re, str);
|
||||
};
|
||||
rep(/\n/gi, '<br />');
|
||||
rep(/\[b\]/gi, '<strong>');
|
||||
rep(/\[\/b\]/gi, '</strong>');
|
||||
rep(/\[i\]/gi, '<em>');
|
||||
rep(/\[\/i\]/gi, '</em>');
|
||||
rep(/\[u\]/gi, '<u>');
|
||||
rep(/\[\/u\]/gi, '</u>');
|
||||
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, '<a href="$1">$2</a>');
|
||||
rep(/\[url\](.*?)\[\/url\]/gi, '<a href="$1">$1</a>');
|
||||
rep(/\[img\](.*?)\[\/img\]/gi, '<img src="$1" />');
|
||||
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, '<font color="$1">$2</font>');
|
||||
rep(/\[code\](.*?)\[\/code\]/gi, '<span class="codeStyle">$1</span> ');
|
||||
rep(/\[quote.*?\](.*?)\[\/quote\]/gi, '<span class="quoteStyle">$1</span> ');
|
||||
return s;
|
||||
};
|
||||
var Convert = {
|
||||
html2bbcode: html2bbcode,
|
||||
bbcode2html: bbcode2html
|
||||
};
|
||||
|
||||
function Plugin () {
|
||||
global.add('bbcode', function (editor) {
|
||||
editor.on('BeforeSetContent', function (e) {
|
||||
e.content = Convert.bbcode2html(e.content);
|
||||
});
|
||||
editor.on('PostProcess', function (e) {
|
||||
if (e.set) {
|
||||
e.content = Convert.bbcode2html(e.content);
|
||||
}
|
||||
if (e.get) {
|
||||
e.content = Convert.html2bbcode(e.content);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";var o=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.util.Tools"),t=function(t){t=e.trim(t);function o(o,e){t=t.replace(o,e)}return o(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),o(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),o(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),o(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),o(/<font>(.*?)<\/font>/gi,"$1"),o(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),o(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),o(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),o(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),o(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),o(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),o(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),o(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),o(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),o(/<\/(strong|b)>/gi,"[/b]"),o(/<(strong|b)>/gi,"[b]"),o(/<\/(em|i)>/gi,"[/i]"),o(/<(em|i)>/gi,"[i]"),o(/<\/u>/gi,"[/u]"),o(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),o(/<u>/gi,"[u]"),o(/<blockquote[^>]*>/gi,"[quote]"),o(/<\/blockquote>/gi,"[/quote]"),o(/<br \/>/gi,"\n"),o(/<br\/>/gi,"\n"),o(/<br>/gi,"\n"),o(/<p>/gi,""),o(/<\/p>/gi,"\n"),o(/ |\u00a0/gi," "),o(/"/gi,'"'),o(/</gi,"<"),o(/>/gi,">"),o(/&/gi,"&"),t},i=function(t){t=e.trim(t);function o(o,e){t=t.replace(o,e)}return o(/\n/gi,"<br />"),o(/\[b\]/gi,"<strong>"),o(/\[\/b\]/gi,"</strong>"),o(/\[i\]/gi,"<em>"),o(/\[\/i\]/gi,"</em>"),o(/\[u\]/gi,"<u>"),o(/\[\/u\]/gi,"</u>"),o(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),o(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),o(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),o(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),o(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span> '),o(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span> '),t};!function n(){o.add("bbcode",function(o){o.on("BeforeSetContent",function(o){o.content=i(o.content)}),o.on("PostProcess",function(o){o.set&&(o.content=i(o.content)),o.get&&(o.content=t(o.content))})})}()}();
|
@ -0,0 +1,99 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var setContent = function (editor, html) {
|
||||
editor.focus();
|
||||
editor.undoManager.transact(function () {
|
||||
editor.setContent(html);
|
||||
});
|
||||
editor.selection.setCursorLocation();
|
||||
editor.nodeChanged();
|
||||
};
|
||||
var getContent = function (editor) {
|
||||
return editor.getContent({ source_view: true });
|
||||
};
|
||||
var Content = {
|
||||
setContent: setContent,
|
||||
getContent: getContent
|
||||
};
|
||||
|
||||
var open = function (editor) {
|
||||
var editorContent = Content.getContent(editor);
|
||||
editor.windowManager.open({
|
||||
title: 'Source Code',
|
||||
size: 'large',
|
||||
body: {
|
||||
type: 'panel',
|
||||
items: [{
|
||||
type: 'textarea',
|
||||
name: 'code'
|
||||
}]
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
type: 'cancel',
|
||||
name: 'cancel',
|
||||
text: 'Cancel'
|
||||
},
|
||||
{
|
||||
type: 'submit',
|
||||
name: 'save',
|
||||
text: 'Save',
|
||||
primary: true
|
||||
}
|
||||
],
|
||||
initialData: { code: editorContent },
|
||||
onSubmit: function (api) {
|
||||
Content.setContent(editor, api.getData().code);
|
||||
api.close();
|
||||
}
|
||||
});
|
||||
};
|
||||
var Dialog = { open: open };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceCodeEditor', function () {
|
||||
Dialog.open(editor);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.ui.registry.addButton('code', {
|
||||
icon: 'sourcecode',
|
||||
tooltip: 'Source code',
|
||||
onAction: function () {
|
||||
return Dialog.open(editor);
|
||||
}
|
||||
});
|
||||
editor.ui.registry.addMenuItem('code', {
|
||||
icon: 'sourcecode',
|
||||
text: 'Source code',
|
||||
onAction: function () {
|
||||
return Dialog.open(editor);
|
||||
}
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
function Plugin () {
|
||||
global.add('code', function (editor) {
|
||||
Commands.register(editor);
|
||||
Buttons.register(editor);
|
||||
return {};
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(e,n){e.focus(),e.undoManager.transact(function(){e.setContent(n)}),e.selection.setCursorLocation(),e.nodeChanged()},o=function(e){return e.getContent({source_view:!0})},n=function(n){var e=o(n);n.windowManager.open({title:"Source Code",size:"large",body:{type:"panel",items:[{type:"textarea",name:"code"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{code:e},onSubmit:function(e){t(n,e.getData().code),e.close()}})},c=function(e){e.addCommand("mceCodeEditor",function(){n(e)})},i=function(e){e.ui.registry.addButton("code",{icon:"sourcecode",tooltip:"Source code",onAction:function(){return n(e)}}),e.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code",onAction:function(){return n(e)}})};!function u(){e.add("code",function(e){return c(e),i(e),{}})}()}();
|
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function (domGlobals) {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
function Plugin () {
|
||||
global.add('colorpicker', function () {
|
||||
domGlobals.console.warn('Color picker plugin is now built in to the core editor, please remove it from your editor configuration');
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}(window));
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(o){"use strict";var i=tinymce.util.Tools.resolve("tinymce.PluginManager");!function n(){i.add("colorpicker",function(){o.console.warn("Color picker plugin is now built in to the core editor, please remove it from your editor configuration")})}()}(window);
|
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function (domGlobals) {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
function Plugin () {
|
||||
global.add('contextmenu', function () {
|
||||
domGlobals.console.warn('Context menu plugin is now built in to the core editor, please remove it from your editor configuration');
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}(window));
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(n){"use strict";var o=tinymce.util.Tools.resolve("tinymce.PluginManager");!function e(){o.add("contextmenu",function(){n.console.warn("Context menu plugin is now built in to the core editor, please remove it from your editor configuration")})}()}(window);
|
@ -0,0 +1,314 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function (domGlobals) {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var setDir = function (editor, dir) {
|
||||
var dom = editor.dom;
|
||||
var curDir;
|
||||
var blocks = editor.selection.getSelectedBlocks();
|
||||
if (blocks.length) {
|
||||
curDir = dom.getAttrib(blocks[0], 'dir');
|
||||
global$1.each(blocks, function (block) {
|
||||
if (!dom.getParent(block.parentNode, '*[dir="' + dir + '"]', dom.getRoot())) {
|
||||
dom.setAttrib(block, 'dir', curDir !== dir ? dir : null);
|
||||
}
|
||||
});
|
||||
editor.nodeChanged();
|
||||
}
|
||||
};
|
||||
var Direction = { setDir: setDir };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceDirectionLTR', function () {
|
||||
Direction.setDir(editor, 'ltr');
|
||||
});
|
||||
editor.addCommand('mceDirectionRTL', function () {
|
||||
Direction.setDir(editor, 'rtl');
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var noop = function () {
|
||||
};
|
||||
var constant = function (value) {
|
||||
return function () {
|
||||
return value;
|
||||
};
|
||||
};
|
||||
var never = constant(false);
|
||||
var always = constant(true);
|
||||
|
||||
var none = function () {
|
||||
return NONE;
|
||||
};
|
||||
var NONE = function () {
|
||||
var eq = function (o) {
|
||||
return o.isNone();
|
||||
};
|
||||
var call = function (thunk) {
|
||||
return thunk();
|
||||
};
|
||||
var id = function (n) {
|
||||
return n;
|
||||
};
|
||||
var me = {
|
||||
fold: function (n, s) {
|
||||
return n();
|
||||
},
|
||||
is: never,
|
||||
isSome: never,
|
||||
isNone: always,
|
||||
getOr: id,
|
||||
getOrThunk: call,
|
||||
getOrDie: function (msg) {
|
||||
throw new Error(msg || 'error: getOrDie called on none.');
|
||||
},
|
||||
getOrNull: constant(null),
|
||||
getOrUndefined: constant(undefined),
|
||||
or: id,
|
||||
orThunk: call,
|
||||
map: none,
|
||||
each: noop,
|
||||
bind: none,
|
||||
exists: never,
|
||||
forall: always,
|
||||
filter: none,
|
||||
equals: eq,
|
||||
equals_: eq,
|
||||
toArray: function () {
|
||||
return [];
|
||||
},
|
||||
toString: constant('none()')
|
||||
};
|
||||
if (Object.freeze) {
|
||||
Object.freeze(me);
|
||||
}
|
||||
return me;
|
||||
}();
|
||||
var some = function (a) {
|
||||
var constant_a = constant(a);
|
||||
var self = function () {
|
||||
return me;
|
||||
};
|
||||
var bind = function (f) {
|
||||
return f(a);
|
||||
};
|
||||
var me = {
|
||||
fold: function (n, s) {
|
||||
return s(a);
|
||||
},
|
||||
is: function (v) {
|
||||
return a === v;
|
||||
},
|
||||
isSome: always,
|
||||
isNone: never,
|
||||
getOr: constant_a,
|
||||
getOrThunk: constant_a,
|
||||
getOrDie: constant_a,
|
||||
getOrNull: constant_a,
|
||||
getOrUndefined: constant_a,
|
||||
or: self,
|
||||
orThunk: self,
|
||||
map: function (f) {
|
||||
return some(f(a));
|
||||
},
|
||||
each: function (f) {
|
||||
f(a);
|
||||
},
|
||||
bind: bind,
|
||||
exists: bind,
|
||||
forall: bind,
|
||||
filter: function (f) {
|
||||
return f(a) ? me : NONE;
|
||||
},
|
||||
toArray: function () {
|
||||
return [a];
|
||||
},
|
||||
toString: function () {
|
||||
return 'some(' + a + ')';
|
||||
},
|
||||
equals: function (o) {
|
||||
return o.is(a);
|
||||
},
|
||||
equals_: function (o, elementEq) {
|
||||
return o.fold(never, function (b) {
|
||||
return elementEq(a, b);
|
||||
});
|
||||
}
|
||||
};
|
||||
return me;
|
||||
};
|
||||
var from = function (value) {
|
||||
return value === null || value === undefined ? NONE : some(value);
|
||||
};
|
||||
var Option = {
|
||||
some: some,
|
||||
none: none,
|
||||
from: from
|
||||
};
|
||||
|
||||
var fromHtml = function (html, scope) {
|
||||
var doc = scope || domGlobals.document;
|
||||
var div = doc.createElement('div');
|
||||
div.innerHTML = html;
|
||||
if (!div.hasChildNodes() || div.childNodes.length > 1) {
|
||||
domGlobals.console.error('HTML does not have a single root node', html);
|
||||
throw new Error('HTML must have a single root node');
|
||||
}
|
||||
return fromDom(div.childNodes[0]);
|
||||
};
|
||||
var fromTag = function (tag, scope) {
|
||||
var doc = scope || domGlobals.document;
|
||||
var node = doc.createElement(tag);
|
||||
return fromDom(node);
|
||||
};
|
||||
var fromText = function (text, scope) {
|
||||
var doc = scope || domGlobals.document;
|
||||
var node = doc.createTextNode(text);
|
||||
return fromDom(node);
|
||||
};
|
||||
var fromDom = function (node) {
|
||||
if (node === null || node === undefined) {
|
||||
throw new Error('Node cannot be null or undefined');
|
||||
}
|
||||
return { dom: constant(node) };
|
||||
};
|
||||
var fromPoint = function (docElm, x, y) {
|
||||
var doc = docElm.dom();
|
||||
return Option.from(doc.elementFromPoint(x, y)).map(fromDom);
|
||||
};
|
||||
var Element = {
|
||||
fromHtml: fromHtml,
|
||||
fromTag: fromTag,
|
||||
fromText: fromText,
|
||||
fromDom: fromDom,
|
||||
fromPoint: fromPoint
|
||||
};
|
||||
|
||||
var typeOf = function (x) {
|
||||
if (x === null) {
|
||||
return 'null';
|
||||
}
|
||||
var t = typeof x;
|
||||
if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
|
||||
return 'array';
|
||||
}
|
||||
if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
|
||||
return 'string';
|
||||
}
|
||||
return t;
|
||||
};
|
||||
var isType = function (type) {
|
||||
return function (value) {
|
||||
return typeOf(value) === type;
|
||||
};
|
||||
};
|
||||
var isFunction = isType('function');
|
||||
|
||||
var nativeSlice = Array.prototype.slice;
|
||||
var from$1 = isFunction(Array.from) ? Array.from : function (x) {
|
||||
return nativeSlice.call(x);
|
||||
};
|
||||
|
||||
var isSupported = function (dom) {
|
||||
return dom.style !== undefined && isFunction(dom.style.getPropertyValue);
|
||||
};
|
||||
|
||||
var ATTRIBUTE = domGlobals.Node.ATTRIBUTE_NODE;
|
||||
var CDATA_SECTION = domGlobals.Node.CDATA_SECTION_NODE;
|
||||
var COMMENT = domGlobals.Node.COMMENT_NODE;
|
||||
var DOCUMENT = domGlobals.Node.DOCUMENT_NODE;
|
||||
var DOCUMENT_TYPE = domGlobals.Node.DOCUMENT_TYPE_NODE;
|
||||
var DOCUMENT_FRAGMENT = domGlobals.Node.DOCUMENT_FRAGMENT_NODE;
|
||||
var ELEMENT = domGlobals.Node.ELEMENT_NODE;
|
||||
var TEXT = domGlobals.Node.TEXT_NODE;
|
||||
var PROCESSING_INSTRUCTION = domGlobals.Node.PROCESSING_INSTRUCTION_NODE;
|
||||
var ENTITY_REFERENCE = domGlobals.Node.ENTITY_REFERENCE_NODE;
|
||||
var ENTITY = domGlobals.Node.ENTITY_NODE;
|
||||
var NOTATION = domGlobals.Node.NOTATION_NODE;
|
||||
|
||||
var Global = typeof domGlobals.window !== 'undefined' ? domGlobals.window : Function('return this;')();
|
||||
|
||||
var type = function (element) {
|
||||
return element.dom().nodeType;
|
||||
};
|
||||
var isType$1 = function (t) {
|
||||
return function (element) {
|
||||
return type(element) === t;
|
||||
};
|
||||
};
|
||||
var isText = isType$1(TEXT);
|
||||
|
||||
var inBody = function (element) {
|
||||
var dom = isText(element) ? element.dom().parentNode : element.dom();
|
||||
return dom !== undefined && dom !== null && dom.ownerDocument.body.contains(dom);
|
||||
};
|
||||
|
||||
var get = function (element, property) {
|
||||
var dom = element.dom();
|
||||
var styles = domGlobals.window.getComputedStyle(dom);
|
||||
var r = styles.getPropertyValue(property);
|
||||
var v = r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;
|
||||
return v === null ? undefined : v;
|
||||
};
|
||||
var getUnsafeProperty = function (dom, property) {
|
||||
return isSupported(dom) ? dom.style.getPropertyValue(property) : '';
|
||||
};
|
||||
|
||||
var getDirection = function (element) {
|
||||
return get(element, 'direction') === 'rtl' ? 'rtl' : 'ltr';
|
||||
};
|
||||
|
||||
var getNodeChangeHandler = function (editor, dir) {
|
||||
return function (api) {
|
||||
var nodeChangeHandler = function (e) {
|
||||
var element = Element.fromDom(e.element);
|
||||
api.setActive(getDirection(element) === dir);
|
||||
};
|
||||
editor.on('NodeChange', nodeChangeHandler);
|
||||
return function () {
|
||||
return editor.off('NodeChange', nodeChangeHandler);
|
||||
};
|
||||
};
|
||||
};
|
||||
var register$1 = function (editor) {
|
||||
editor.ui.registry.addToggleButton('ltr', {
|
||||
tooltip: 'Left to right',
|
||||
icon: 'ltr',
|
||||
onAction: function () {
|
||||
return editor.execCommand('mceDirectionLTR');
|
||||
},
|
||||
onSetup: getNodeChangeHandler(editor, 'ltr')
|
||||
});
|
||||
editor.ui.registry.addToggleButton('rtl', {
|
||||
tooltip: 'Right to left',
|
||||
icon: 'rtl',
|
||||
onAction: function () {
|
||||
return editor.execCommand('mceDirectionRTL');
|
||||
},
|
||||
onSetup: getNodeChangeHandler(editor, 'rtl')
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
function Plugin () {
|
||||
global.add('directionality', function (editor) {
|
||||
Commands.register(editor);
|
||||
Buttons.register(editor);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}(window));
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(i){"use strict";function n(){}function u(n){return function(){return n}}function t(){return a}var e,r=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),o=function(n,t){var e,r=n.dom,o=n.selection.getSelectedBlocks();o.length&&(e=r.getAttrib(o[0],"dir"),c.each(o,function(n){r.getParent(n.parentNode,'*[dir="'+t+'"]',r.getRoot())||r.setAttrib(n,"dir",e!==t?t:null)}),n.nodeChanged())},d=function(n){n.addCommand("mceDirectionLTR",function(){o(n,"ltr")}),n.addCommand("mceDirectionRTL",function(){o(n,"rtl")})},f=u(!1),l=u(!0),a=(e={fold:function(n,t){return n()},is:f,isSome:f,isNone:l,getOr:s,getOrThunk:N,getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:u(null),getOrUndefined:u(undefined),or:s,orThunk:N,map:t,each:n,bind:t,exists:f,forall:l,filter:t,equals:m,equals_:m,toArray:function(){return[]},toString:u("none()")},Object.freeze&&Object.freeze(e),e);function m(n){return n.isNone()}function N(n){return n()}function s(n){return n}function g(n,t){var e=n.dom(),r=i.window.getComputedStyle(e).getPropertyValue(t),o=""!==r||function(n){var t=A(n)?n.dom().parentNode:n.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)}(n)?r:w(e,t);return null===o?undefined:o}function T(t,r){return function(e){function n(n){var t=p.fromDom(n.element);e.setActive(function(n){return"rtl"===g(n,"direction")?"rtl":"ltr"}(t)===r)}return t.on("NodeChange",n),function(){return t.off("NodeChange",n)}}}var E,O,y=function(e){function n(){return o}function t(n){return n(e)}var r=u(e),o={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:l,isNone:f,getOr:r,getOrThunk:r,getOrDie:r,getOrNull:r,getOrUndefined:r,or:n,orThunk:n,map:function(n){return y(n(e))},each:function(n){n(e)},bind:t,exists:t,forall:t,filter:function(n){return n(e)?o:a},toArray:function(){return[e]},toString:function(){return"some("+e+")"},equals:function(n){return n.is(e)},equals_:function(n,t){return n.fold(f,function(n){return t(e,n)})}};return o},D=function(n){return null===n||n===undefined?a:y(n)},h=function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:u(n)}},p={fromHtml:function(n,t){var e=(t||i.document).createElement("div");if(e.innerHTML=n,!e.hasChildNodes()||1<e.childNodes.length)throw i.console.error("HTML does not have a single root node",n),new Error("HTML must have a single root node");return h(e.childNodes[0])},fromTag:function(n,t){var e=(t||i.document).createElement(n);return h(e)},fromText:function(n,t){var e=(t||i.document).createTextNode(n);return h(e)},fromDom:h,fromPoint:function(n,t,e){var r=n.dom();return D(r.elementFromPoint(t,e)).map(h)}},_=(E="function",function(n){return function(n){if(null===n)return"null";var t=typeof n;return"object"==t&&(Array.prototype.isPrototypeOf(n)||n.constructor&&"Array"===n.constructor.name)?"array":"object"==t&&(String.prototype.isPrototypeOf(n)||n.constructor&&"String"===n.constructor.name)?"string":t}(n)===E}),v=Array.prototype.slice,C=(_(Array.from)&&Array.from,i.Node.ATTRIBUTE_NODE,i.Node.CDATA_SECTION_NODE,i.Node.COMMENT_NODE,i.Node.DOCUMENT_NODE,i.Node.DOCUMENT_TYPE_NODE,i.Node.DOCUMENT_FRAGMENT_NODE,i.Node.ELEMENT_NODE,i.Node.TEXT_NODE),A=(i.Node.PROCESSING_INSTRUCTION_NODE,i.Node.ENTITY_REFERENCE_NODE,i.Node.ENTITY_NODE,i.Node.NOTATION_NODE,"undefined"!=typeof i.window?i.window:Function("return this;")(),O=C,function(n){return function(n){return n.dom().nodeType}(n)===O}),w=function(n,t){return function(n){return n.style!==undefined&&_(n.style.getPropertyValue)}(n)?n.style.getPropertyValue(t):""},S=function(n){n.ui.registry.addToggleButton("ltr",{tooltip:"Left to right",icon:"ltr",onAction:function(){return n.execCommand("mceDirectionLTR")},onSetup:T(n,"ltr")}),n.ui.registry.addToggleButton("rtl",{tooltip:"Right to left",icon:"rtl",onAction:function(){return n.execCommand("mceDirectionRTL")},onSetup:T(n,"rtl")})};!function R(){r.add("directionality",function(n){d(n),S(n)})}()}(window);
|
@ -0,0 +1,602 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function (domGlobals) {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var noop = function () {
|
||||
};
|
||||
var constant = function (value) {
|
||||
return function () {
|
||||
return value;
|
||||
};
|
||||
};
|
||||
var never = constant(false);
|
||||
var always = constant(true);
|
||||
|
||||
var none = function () {
|
||||
return NONE;
|
||||
};
|
||||
var NONE = function () {
|
||||
var eq = function (o) {
|
||||
return o.isNone();
|
||||
};
|
||||
var call = function (thunk) {
|
||||
return thunk();
|
||||
};
|
||||
var id = function (n) {
|
||||
return n;
|
||||
};
|
||||
var me = {
|
||||
fold: function (n, s) {
|
||||
return n();
|
||||
},
|
||||
is: never,
|
||||
isSome: never,
|
||||
isNone: always,
|
||||
getOr: id,
|
||||
getOrThunk: call,
|
||||
getOrDie: function (msg) {
|
||||
throw new Error(msg || 'error: getOrDie called on none.');
|
||||
},
|
||||
getOrNull: constant(null),
|
||||
getOrUndefined: constant(undefined),
|
||||
or: id,
|
||||
orThunk: call,
|
||||
map: none,
|
||||
each: noop,
|
||||
bind: none,
|
||||
exists: never,
|
||||
forall: always,
|
||||
filter: none,
|
||||
equals: eq,
|
||||
equals_: eq,
|
||||
toArray: function () {
|
||||
return [];
|
||||
},
|
||||
toString: constant('none()')
|
||||
};
|
||||
if (Object.freeze) {
|
||||
Object.freeze(me);
|
||||
}
|
||||
return me;
|
||||
}();
|
||||
var some = function (a) {
|
||||
var constant_a = constant(a);
|
||||
var self = function () {
|
||||
return me;
|
||||
};
|
||||
var bind = function (f) {
|
||||
return f(a);
|
||||
};
|
||||
var me = {
|
||||
fold: function (n, s) {
|
||||
return s(a);
|
||||
},
|
||||
is: function (v) {
|
||||
return a === v;
|
||||
},
|
||||
isSome: always,
|
||||
isNone: never,
|
||||
getOr: constant_a,
|
||||
getOrThunk: constant_a,
|
||||
getOrDie: constant_a,
|
||||
getOrNull: constant_a,
|
||||
getOrUndefined: constant_a,
|
||||
or: self,
|
||||
orThunk: self,
|
||||
map: function (f) {
|
||||
return some(f(a));
|
||||
},
|
||||
each: function (f) {
|
||||
f(a);
|
||||
},
|
||||
bind: bind,
|
||||
exists: bind,
|
||||
forall: bind,
|
||||
filter: function (f) {
|
||||
return f(a) ? me : NONE;
|
||||
},
|
||||
toArray: function () {
|
||||
return [a];
|
||||
},
|
||||
toString: function () {
|
||||
return 'some(' + a + ')';
|
||||
},
|
||||
equals: function (o) {
|
||||
return o.is(a);
|
||||
},
|
||||
equals_: function (o, elementEq) {
|
||||
return o.fold(never, function (b) {
|
||||
return elementEq(a, b);
|
||||
});
|
||||
}
|
||||
};
|
||||
return me;
|
||||
};
|
||||
var from = function (value) {
|
||||
return value === null || value === undefined ? NONE : some(value);
|
||||
};
|
||||
var Option = {
|
||||
some: some,
|
||||
none: none,
|
||||
from: from
|
||||
};
|
||||
|
||||
var typeOf = function (x) {
|
||||
if (x === null) {
|
||||
return 'null';
|
||||
}
|
||||
var t = typeof x;
|
||||
if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
|
||||
return 'array';
|
||||
}
|
||||
if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
|
||||
return 'string';
|
||||
}
|
||||
return t;
|
||||
};
|
||||
var isType = function (type) {
|
||||
return function (value) {
|
||||
return typeOf(value) === type;
|
||||
};
|
||||
};
|
||||
var isFunction = isType('function');
|
||||
|
||||
var nativeSlice = Array.prototype.slice;
|
||||
var exists = function (xs, pred) {
|
||||
for (var i = 0, len = xs.length; i < len; i++) {
|
||||
var x = xs[i];
|
||||
if (pred(x, i)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
var map = function (xs, f) {
|
||||
var len = xs.length;
|
||||
var r = new Array(len);
|
||||
for (var i = 0; i < len; i++) {
|
||||
var x = xs[i];
|
||||
r[i] = f(x, i);
|
||||
}
|
||||
return r;
|
||||
};
|
||||
var from$1 = isFunction(Array.from) ? Array.from : function (x) {
|
||||
return nativeSlice.call(x);
|
||||
};
|
||||
|
||||
var contains = function (str, substr) {
|
||||
return str.indexOf(substr) !== -1;
|
||||
};
|
||||
|
||||
var emojiMatches = function (emoji, lowerCasePattern) {
|
||||
return contains(emoji.title.toLowerCase(), lowerCasePattern) || exists(emoji.keywords, function (k) {
|
||||
return contains(k.toLowerCase(), lowerCasePattern);
|
||||
});
|
||||
};
|
||||
var emojisFrom = function (list, pattern, maxResults) {
|
||||
var matches = [];
|
||||
var lowerCasePattern = pattern.toLowerCase();
|
||||
var reachedLimit = maxResults.fold(function () {
|
||||
return never;
|
||||
}, function (max) {
|
||||
return function (size) {
|
||||
return size >= max;
|
||||
};
|
||||
});
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
if (pattern.length === 0 || emojiMatches(list[i], lowerCasePattern)) {
|
||||
matches.push({
|
||||
value: list[i].char,
|
||||
text: list[i].title,
|
||||
icon: list[i].char
|
||||
});
|
||||
if (reachedLimit(matches.length)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return matches;
|
||||
};
|
||||
|
||||
var init = function (editor, database) {
|
||||
editor.ui.registry.addAutocompleter('emoticons', {
|
||||
ch: ':',
|
||||
columns: 'auto',
|
||||
minChars: 2,
|
||||
fetch: function (pattern, maxResults) {
|
||||
return database.waitForLoad().then(function () {
|
||||
var candidates = database.listAll();
|
||||
return emojisFrom(candidates, pattern, Option.some(maxResults));
|
||||
});
|
||||
},
|
||||
onAction: function (autocompleteApi, rng, value) {
|
||||
editor.selection.setRng(rng);
|
||||
editor.insertContent(value);
|
||||
autocompleteApi.hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var last = function (fn, rate) {
|
||||
var timer = null;
|
||||
var cancel = function () {
|
||||
if (timer !== null) {
|
||||
domGlobals.clearTimeout(timer);
|
||||
timer = null;
|
||||
}
|
||||
};
|
||||
var throttle = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
if (timer !== null) {
|
||||
domGlobals.clearTimeout(timer);
|
||||
}
|
||||
timer = domGlobals.setTimeout(function () {
|
||||
fn.apply(null, args);
|
||||
timer = null;
|
||||
}, rate);
|
||||
};
|
||||
return {
|
||||
cancel: cancel,
|
||||
throttle: throttle
|
||||
};
|
||||
};
|
||||
|
||||
var insertEmoticon = function (editor, ch) {
|
||||
editor.insertContent(ch);
|
||||
};
|
||||
|
||||
var __assign = function () {
|
||||
__assign = Object.assign || function __assign(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s)
|
||||
if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
var shallow = function (old, nu) {
|
||||
return nu;
|
||||
};
|
||||
var baseMerge = function (merger) {
|
||||
return function () {
|
||||
var objects = new Array(arguments.length);
|
||||
for (var i = 0; i < objects.length; i++) {
|
||||
objects[i] = arguments[i];
|
||||
}
|
||||
if (objects.length === 0) {
|
||||
throw new Error('Can\'t merge zero objects');
|
||||
}
|
||||
var ret = {};
|
||||
for (var j = 0; j < objects.length; j++) {
|
||||
var curObject = objects[j];
|
||||
for (var key in curObject) {
|
||||
if (hasOwnProperty.call(curObject, key)) {
|
||||
ret[key] = merger(ret[key], curObject[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
};
|
||||
var merge = baseMerge(shallow);
|
||||
|
||||
var keys = Object.keys;
|
||||
var hasOwnProperty$1 = Object.hasOwnProperty;
|
||||
var each = function (obj, f) {
|
||||
var props = keys(obj);
|
||||
for (var k = 0, len = props.length; k < len; k++) {
|
||||
var i = props[k];
|
||||
var x = obj[i];
|
||||
f(x, i);
|
||||
}
|
||||
};
|
||||
var map$1 = function (obj, f) {
|
||||
return tupleMap(obj, function (x, i) {
|
||||
return {
|
||||
k: i,
|
||||
v: f(x, i)
|
||||
};
|
||||
});
|
||||
};
|
||||
var tupleMap = function (obj, f) {
|
||||
var r = {};
|
||||
each(obj, function (x, i) {
|
||||
var tuple = f(x, i);
|
||||
r[tuple.k] = tuple.v;
|
||||
});
|
||||
return r;
|
||||
};
|
||||
var has = function (obj, key) {
|
||||
return hasOwnProperty$1.call(obj, key);
|
||||
};
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.Resource');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Promise');
|
||||
|
||||
var DEFAULT_ID = 'tinymce.plugins.emoticons';
|
||||
var getEmoticonDatabaseUrl = function (editor, pluginUrl) {
|
||||
return editor.getParam('emoticons_database_url', pluginUrl + '/js/emojis' + editor.suffix + '.js');
|
||||
};
|
||||
var getEmoticonDatabaseId = function (editor) {
|
||||
return editor.getParam('emoticons_database_id', DEFAULT_ID, 'string');
|
||||
};
|
||||
var getAppendedEmoticons = function (editor) {
|
||||
return editor.getParam('emoticons_append', {}, 'object');
|
||||
};
|
||||
var Settings = {
|
||||
getEmoticonDatabaseUrl: getEmoticonDatabaseUrl,
|
||||
getEmoticonDatabaseId: getEmoticonDatabaseId,
|
||||
getAppendedEmoticons: getAppendedEmoticons
|
||||
};
|
||||
|
||||
var ALL_CATEGORY = 'All';
|
||||
var categoryNameMap = {
|
||||
symbols: 'Symbols',
|
||||
people: 'People',
|
||||
animals_and_nature: 'Animals and Nature',
|
||||
food_and_drink: 'Food and Drink',
|
||||
activity: 'Activity',
|
||||
travel_and_places: 'Travel and Places',
|
||||
objects: 'Objects',
|
||||
flags: 'Flags',
|
||||
user: 'User Defined'
|
||||
};
|
||||
var translateCategory = function (categories, name) {
|
||||
return has(categories, name) ? categories[name] : name;
|
||||
};
|
||||
var getUserDefinedEmoticons = function (editor) {
|
||||
var userDefinedEmoticons = Settings.getAppendedEmoticons(editor);
|
||||
return map$1(userDefinedEmoticons, function (value) {
|
||||
return __assign({
|
||||
keywords: [],
|
||||
category: 'user'
|
||||
}, value);
|
||||
});
|
||||
};
|
||||
var initDatabase = function (editor, databaseUrl, databaseId) {
|
||||
var categories = Cell(Option.none());
|
||||
var all = Cell(Option.none());
|
||||
var processEmojis = function (emojis) {
|
||||
var cats = {};
|
||||
var everything = [];
|
||||
each(emojis, function (lib, title) {
|
||||
var entry = {
|
||||
title: title,
|
||||
keywords: lib.keywords,
|
||||
char: lib.char,
|
||||
category: translateCategory(categoryNameMap, lib.category)
|
||||
};
|
||||
var current = cats[entry.category] !== undefined ? cats[entry.category] : [];
|
||||
cats[entry.category] = current.concat([entry]);
|
||||
everything.push(entry);
|
||||
});
|
||||
categories.set(Option.some(cats));
|
||||
all.set(Option.some(everything));
|
||||
};
|
||||
editor.on('init', function () {
|
||||
global$1.load(databaseId, databaseUrl).then(function (emojis) {
|
||||
var userEmojis = getUserDefinedEmoticons(editor);
|
||||
processEmojis(merge(emojis, userEmojis));
|
||||
}, function (err) {
|
||||
domGlobals.console.log('Failed to load emoticons: ' + err);
|
||||
categories.set(Option.some({}));
|
||||
all.set(Option.some([]));
|
||||
});
|
||||
});
|
||||
var listCategory = function (category) {
|
||||
if (category === ALL_CATEGORY) {
|
||||
return listAll();
|
||||
}
|
||||
return categories.get().bind(function (cats) {
|
||||
return Option.from(cats[category]);
|
||||
}).getOr([]);
|
||||
};
|
||||
var listAll = function () {
|
||||
return all.get().getOr([]);
|
||||
};
|
||||
var listCategories = function () {
|
||||
return [ALL_CATEGORY].concat(keys(categories.get().getOr({})));
|
||||
};
|
||||
var waitForLoad = function () {
|
||||
if (hasLoaded()) {
|
||||
return global$3.resolve(true);
|
||||
} else {
|
||||
return new global$3(function (resolve, reject) {
|
||||
var numRetries = 15;
|
||||
var interval = global$2.setInterval(function () {
|
||||
if (hasLoaded()) {
|
||||
global$2.clearInterval(interval);
|
||||
resolve(true);
|
||||
} else {
|
||||
numRetries--;
|
||||
if (numRetries < 0) {
|
||||
domGlobals.console.log('Could not load emojis from url: ' + databaseUrl);
|
||||
global$2.clearInterval(interval);
|
||||
reject(false);
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
};
|
||||
var hasLoaded = function () {
|
||||
return categories.get().isSome() && all.get().isSome();
|
||||
};
|
||||
return {
|
||||
listCategories: listCategories,
|
||||
hasLoaded: hasLoaded,
|
||||
waitForLoad: waitForLoad,
|
||||
listAll: listAll,
|
||||
listCategory: listCategory
|
||||
};
|
||||
};
|
||||
|
||||
var patternName = 'pattern';
|
||||
var open = function (editor, database) {
|
||||
var initialState = {
|
||||
pattern: '',
|
||||
results: emojisFrom(database.listAll(), '', Option.some(300))
|
||||
};
|
||||
var currentTab = Cell(ALL_CATEGORY);
|
||||
var scan = function (dialogApi) {
|
||||
var dialogData = dialogApi.getData();
|
||||
var category = currentTab.get();
|
||||
var candidates = database.listCategory(category);
|
||||
var results = emojisFrom(candidates, dialogData[patternName], category === ALL_CATEGORY ? Option.some(300) : Option.none());
|
||||
dialogApi.setData({ results: results });
|
||||
};
|
||||
var updateFilter = last(function (dialogApi) {
|
||||
scan(dialogApi);
|
||||
}, 200);
|
||||
var searchField = {
|
||||
label: 'Search',
|
||||
type: 'input',
|
||||
name: patternName
|
||||
};
|
||||
var resultsField = {
|
||||
type: 'collection',
|
||||
name: 'results'
|
||||
};
|
||||
var getInitialState = function () {
|
||||
var body = {
|
||||
type: 'tabpanel',
|
||||
tabs: map(database.listCategories(), function (cat) {
|
||||
return {
|
||||
title: cat,
|
||||
name: cat,
|
||||
items: [
|
||||
searchField,
|
||||
resultsField
|
||||
]
|
||||
};
|
||||
})
|
||||
};
|
||||
return {
|
||||
title: 'Emoticons',
|
||||
size: 'normal',
|
||||
body: body,
|
||||
initialData: initialState,
|
||||
onTabChange: function (dialogApi, details) {
|
||||
currentTab.set(details.newTabName);
|
||||
updateFilter.throttle(dialogApi);
|
||||
},
|
||||
onChange: updateFilter.throttle,
|
||||
onAction: function (dialogApi, actionData) {
|
||||
if (actionData.name === 'results') {
|
||||
insertEmoticon(editor, actionData.value);
|
||||
dialogApi.close();
|
||||
}
|
||||
},
|
||||
buttons: [{
|
||||
type: 'cancel',
|
||||
text: 'Close',
|
||||
primary: true
|
||||
}]
|
||||
};
|
||||
};
|
||||
var dialogApi = editor.windowManager.open(getInitialState());
|
||||
dialogApi.focus(patternName);
|
||||
if (!database.hasLoaded()) {
|
||||
dialogApi.block('Loading emoticons...');
|
||||
database.waitForLoad().then(function () {
|
||||
dialogApi.redial(getInitialState());
|
||||
updateFilter.throttle(dialogApi);
|
||||
dialogApi.focus(patternName);
|
||||
dialogApi.unblock();
|
||||
}).catch(function (err) {
|
||||
dialogApi.redial({
|
||||
title: 'Emoticons',
|
||||
body: {
|
||||
type: 'panel',
|
||||
items: [{
|
||||
type: 'alertbanner',
|
||||
level: 'error',
|
||||
icon: 'warning',
|
||||
text: '<p>Could not load emoticons</p>'
|
||||
}]
|
||||
},
|
||||
buttons: [{
|
||||
type: 'cancel',
|
||||
text: 'Close',
|
||||
primary: true
|
||||
}],
|
||||
initialData: {
|
||||
pattern: '',
|
||||
results: []
|
||||
}
|
||||
});
|
||||
dialogApi.focus(patternName);
|
||||
dialogApi.unblock();
|
||||
});
|
||||
}
|
||||
};
|
||||
var Dialog = { open: open };
|
||||
|
||||
var register = function (editor, database) {
|
||||
var onAction = function () {
|
||||
return Dialog.open(editor, database);
|
||||
};
|
||||
editor.ui.registry.addButton('emoticons', {
|
||||
tooltip: 'Emoticons',
|
||||
icon: 'emoji',
|
||||
onAction: onAction
|
||||
});
|
||||
editor.ui.registry.addMenuItem('emoticons', {
|
||||
text: 'Emoticons...',
|
||||
icon: 'emoji',
|
||||
onAction: onAction
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register };
|
||||
|
||||
function Plugin () {
|
||||
global.add('emoticons', function (editor, pluginUrl) {
|
||||
var databaseUrl = Settings.getEmoticonDatabaseUrl(editor, pluginUrl);
|
||||
var databaseId = Settings.getEmoticonDatabaseId(editor);
|
||||
var database = initDatabase(editor, databaseUrl, databaseId);
|
||||
Buttons.register(editor, database);
|
||||
init(editor, database);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}(window));
|
@ -0,0 +1,568 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function (domGlobals) {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var __assign = function () {
|
||||
__assign = Object.assign || function __assign(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s)
|
||||
if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.html.DomParser');
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.html.Node');
|
||||
|
||||
var global$4 = tinymce.util.Tools.resolve('tinymce.html.Serializer');
|
||||
|
||||
var shouldHideInSourceView = function (editor) {
|
||||
return editor.getParam('fullpage_hide_in_source_view');
|
||||
};
|
||||
var getDefaultXmlPi = function (editor) {
|
||||
return editor.getParam('fullpage_default_xml_pi');
|
||||
};
|
||||
var getDefaultEncoding = function (editor) {
|
||||
return editor.getParam('fullpage_default_encoding');
|
||||
};
|
||||
var getDefaultFontFamily = function (editor) {
|
||||
return editor.getParam('fullpage_default_font_family');
|
||||
};
|
||||
var getDefaultFontSize = function (editor) {
|
||||
return editor.getParam('fullpage_default_font_size');
|
||||
};
|
||||
var getDefaultTextColor = function (editor) {
|
||||
return editor.getParam('fullpage_default_text_color');
|
||||
};
|
||||
var getDefaultTitle = function (editor) {
|
||||
return editor.getParam('fullpage_default_title');
|
||||
};
|
||||
var getDefaultDocType = function (editor) {
|
||||
return editor.getParam('fullpage_default_doctype', '<!DOCTYPE html>');
|
||||
};
|
||||
var Settings = {
|
||||
shouldHideInSourceView: shouldHideInSourceView,
|
||||
getDefaultXmlPi: getDefaultXmlPi,
|
||||
getDefaultEncoding: getDefaultEncoding,
|
||||
getDefaultFontFamily: getDefaultFontFamily,
|
||||
getDefaultFontSize: getDefaultFontSize,
|
||||
getDefaultTextColor: getDefaultTextColor,
|
||||
getDefaultTitle: getDefaultTitle,
|
||||
getDefaultDocType: getDefaultDocType
|
||||
};
|
||||
|
||||
var parseHeader = function (head) {
|
||||
return global$2({
|
||||
validate: false,
|
||||
root_name: '#document'
|
||||
}).parse(head, { format: 'xhtml' });
|
||||
};
|
||||
var htmlToData = function (editor, head) {
|
||||
var headerFragment = parseHeader(head);
|
||||
var data = {};
|
||||
var elm, matches;
|
||||
function getAttr(elm, name) {
|
||||
var value = elm.attr(name);
|
||||
return value || '';
|
||||
}
|
||||
data.fontface = Settings.getDefaultFontFamily(editor);
|
||||
data.fontsize = Settings.getDefaultFontSize(editor);
|
||||
elm = headerFragment.firstChild;
|
||||
if (elm.type === 7) {
|
||||
data.xml_pi = true;
|
||||
matches = /encoding="([^"]+)"/.exec(elm.value);
|
||||
if (matches) {
|
||||
data.docencoding = matches[1];
|
||||
}
|
||||
}
|
||||
elm = headerFragment.getAll('#doctype')[0];
|
||||
if (elm) {
|
||||
data.doctype = '<!DOCTYPE' + elm.value + '>';
|
||||
}
|
||||
elm = headerFragment.getAll('title')[0];
|
||||
if (elm && elm.firstChild) {
|
||||
data.title = elm.firstChild.value;
|
||||
}
|
||||
global$1.each(headerFragment.getAll('meta'), function (meta) {
|
||||
var name = meta.attr('name');
|
||||
var httpEquiv = meta.attr('http-equiv');
|
||||
var matches;
|
||||
if (name) {
|
||||
data[name.toLowerCase()] = meta.attr('content');
|
||||
} else if (httpEquiv === 'Content-Type') {
|
||||
matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content'));
|
||||
if (matches) {
|
||||
data.docencoding = matches[1];
|
||||
}
|
||||
}
|
||||
});
|
||||
elm = headerFragment.getAll('html')[0];
|
||||
if (elm) {
|
||||
data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang');
|
||||
}
|
||||
data.stylesheets = [];
|
||||
global$1.each(headerFragment.getAll('link'), function (link) {
|
||||
if (link.attr('rel') === 'stylesheet') {
|
||||
data.stylesheets.push(link.attr('href'));
|
||||
}
|
||||
});
|
||||
elm = headerFragment.getAll('body')[0];
|
||||
if (elm) {
|
||||
data.langdir = getAttr(elm, 'dir');
|
||||
data.style = getAttr(elm, 'style');
|
||||
data.visited_color = getAttr(elm, 'vlink');
|
||||
data.link_color = getAttr(elm, 'link');
|
||||
data.active_color = getAttr(elm, 'alink');
|
||||
}
|
||||
return data;
|
||||
};
|
||||
var dataToHtml = function (editor, data, head) {
|
||||
var headerFragment, headElement, html, elm, value;
|
||||
var dom = editor.dom;
|
||||
function setAttr(elm, name, value) {
|
||||
elm.attr(name, value ? value : undefined);
|
||||
}
|
||||
function addHeadNode(node) {
|
||||
if (headElement.firstChild) {
|
||||
headElement.insert(node, headElement.firstChild);
|
||||
} else {
|
||||
headElement.append(node);
|
||||
}
|
||||
}
|
||||
headerFragment = parseHeader(head);
|
||||
headElement = headerFragment.getAll('head')[0];
|
||||
if (!headElement) {
|
||||
elm = headerFragment.getAll('html')[0];
|
||||
headElement = new global$3('head', 1);
|
||||
if (elm.firstChild) {
|
||||
elm.insert(headElement, elm.firstChild, true);
|
||||
} else {
|
||||
elm.append(headElement);
|
||||
}
|
||||
}
|
||||
elm = headerFragment.firstChild;
|
||||
if (data.xml_pi) {
|
||||
value = 'version="1.0"';
|
||||
if (data.docencoding) {
|
||||
value += ' encoding="' + data.docencoding + '"';
|
||||
}
|
||||
if (elm.type !== 7) {
|
||||
elm = new global$3('xml', 7);
|
||||
headerFragment.insert(elm, headerFragment.firstChild, true);
|
||||
}
|
||||
elm.value = value;
|
||||
} else if (elm && elm.type === 7) {
|
||||
elm.remove();
|
||||
}
|
||||
elm = headerFragment.getAll('#doctype')[0];
|
||||
if (data.doctype) {
|
||||
if (!elm) {
|
||||
elm = new global$3('#doctype', 10);
|
||||
if (data.xml_pi) {
|
||||
headerFragment.insert(elm, headerFragment.firstChild);
|
||||
} else {
|
||||
addHeadNode(elm);
|
||||
}
|
||||
}
|
||||
elm.value = data.doctype.substring(9, data.doctype.length - 1);
|
||||
} else if (elm) {
|
||||
elm.remove();
|
||||
}
|
||||
elm = null;
|
||||
global$1.each(headerFragment.getAll('meta'), function (meta) {
|
||||
if (meta.attr('http-equiv') === 'Content-Type') {
|
||||
elm = meta;
|
||||
}
|
||||
});
|
||||
if (data.docencoding) {
|
||||
if (!elm) {
|
||||
elm = new global$3('meta', 1);
|
||||
elm.attr('http-equiv', 'Content-Type');
|
||||
elm.shortEnded = true;
|
||||
addHeadNode(elm);
|
||||
}
|
||||
elm.attr('content', 'text/html; charset=' + data.docencoding);
|
||||
} else if (elm) {
|
||||
elm.remove();
|
||||
}
|
||||
elm = headerFragment.getAll('title')[0];
|
||||
if (data.title) {
|
||||
if (!elm) {
|
||||
elm = new global$3('title', 1);
|
||||
addHeadNode(elm);
|
||||
} else {
|
||||
elm.empty();
|
||||
}
|
||||
elm.append(new global$3('#text', 3)).value = data.title;
|
||||
} else if (elm) {
|
||||
elm.remove();
|
||||
}
|
||||
global$1.each('keywords,description,author,copyright,robots'.split(','), function (name) {
|
||||
var nodes = headerFragment.getAll('meta');
|
||||
var i, meta;
|
||||
var value = data[name];
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
meta = nodes[i];
|
||||
if (meta.attr('name') === name) {
|
||||
if (value) {
|
||||
meta.attr('content', value);
|
||||
} else {
|
||||
meta.remove();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (value) {
|
||||
elm = new global$3('meta', 1);
|
||||
elm.attr('name', name);
|
||||
elm.attr('content', value);
|
||||
elm.shortEnded = true;
|
||||
addHeadNode(elm);
|
||||
}
|
||||
});
|
||||
var currentStyleSheetsMap = {};
|
||||
global$1.each(headerFragment.getAll('link'), function (stylesheet) {
|
||||
if (stylesheet.attr('rel') === 'stylesheet') {
|
||||
currentStyleSheetsMap[stylesheet.attr('href')] = stylesheet;
|
||||
}
|
||||
});
|
||||
global$1.each(data.stylesheets, function (stylesheet) {
|
||||
if (!currentStyleSheetsMap[stylesheet]) {
|
||||
elm = new global$3('link', 1);
|
||||
elm.attr({
|
||||
rel: 'stylesheet',
|
||||
text: 'text/css',
|
||||
href: stylesheet
|
||||
});
|
||||
elm.shortEnded = true;
|
||||
addHeadNode(elm);
|
||||
}
|
||||
delete currentStyleSheetsMap[stylesheet];
|
||||
});
|
||||
global$1.each(currentStyleSheetsMap, function (stylesheet) {
|
||||
stylesheet.remove();
|
||||
});
|
||||
elm = headerFragment.getAll('body')[0];
|
||||
if (elm) {
|
||||
setAttr(elm, 'dir', data.langdir);
|
||||
setAttr(elm, 'style', data.style);
|
||||
setAttr(elm, 'vlink', data.visited_color);
|
||||
setAttr(elm, 'link', data.link_color);
|
||||
setAttr(elm, 'alink', data.active_color);
|
||||
dom.setAttribs(editor.getBody(), {
|
||||
style: data.style,
|
||||
dir: data.dir,
|
||||
vLink: data.visited_color,
|
||||
link: data.link_color,
|
||||
aLink: data.active_color
|
||||
});
|
||||
}
|
||||
elm = headerFragment.getAll('html')[0];
|
||||
if (elm) {
|
||||
setAttr(elm, 'lang', data.langcode);
|
||||
setAttr(elm, 'xml:lang', data.langcode);
|
||||
}
|
||||
if (!headElement.firstChild) {
|
||||
headElement.remove();
|
||||
}
|
||||
html = global$4({
|
||||
validate: false,
|
||||
indent: true,
|
||||
indent_before: 'head,html,body,meta,title,script,link,style',
|
||||
indent_after: 'head,html,body,meta,title,script,link,style'
|
||||
}).serialize(headerFragment);
|
||||
return html.substring(0, html.indexOf('</body>'));
|
||||
};
|
||||
var Parser = {
|
||||
parseHeader: parseHeader,
|
||||
htmlToData: htmlToData,
|
||||
dataToHtml: dataToHtml
|
||||
};
|
||||
|
||||
var open = function (editor, headState) {
|
||||
var data = Parser.htmlToData(editor, headState.get());
|
||||
var defaultData = {
|
||||
title: '',
|
||||
keywords: '',
|
||||
description: '',
|
||||
robots: '',
|
||||
author: '',
|
||||
docencoding: ''
|
||||
};
|
||||
var initialData = __assign(__assign({}, defaultData), data);
|
||||
editor.windowManager.open({
|
||||
title: 'Metadata and Document Properties',
|
||||
size: 'normal',
|
||||
body: {
|
||||
type: 'panel',
|
||||
items: [
|
||||
{
|
||||
name: 'title',
|
||||
type: 'input',
|
||||
label: 'Title'
|
||||
},
|
||||
{
|
||||
name: 'keywords',
|
||||
type: 'input',
|
||||
label: 'Keywords'
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
type: 'input',
|
||||
label: 'Description'
|
||||
},
|
||||
{
|
||||
name: 'robots',
|
||||
type: 'input',
|
||||
label: 'Robots'
|
||||
},
|
||||
{
|
||||
name: 'author',
|
||||
type: 'input',
|
||||
label: 'Author'
|
||||
},
|
||||
{
|
||||
name: 'docencoding',
|
||||
type: 'input',
|
||||
label: 'Encoding'
|
||||
}
|
||||
]
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
type: 'cancel',
|
||||
name: 'cancel',
|
||||
text: 'Cancel'
|
||||
},
|
||||
{
|
||||
type: 'submit',
|
||||
name: 'save',
|
||||
text: 'Save',
|
||||
primary: true
|
||||
}
|
||||
],
|
||||
initialData: initialData,
|
||||
onSubmit: function (api) {
|
||||
var nuData = api.getData();
|
||||
var headHtml = Parser.dataToHtml(editor, global$1.extend(data, nuData), headState.get());
|
||||
headState.set(headHtml);
|
||||
api.close();
|
||||
}
|
||||
});
|
||||
};
|
||||
var Dialog = { open: open };
|
||||
|
||||
var register = function (editor, headState) {
|
||||
editor.addCommand('mceFullPageProperties', function () {
|
||||
Dialog.open(editor, headState);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var protectHtml = function (protect, html) {
|
||||
global$1.each(protect, function (pattern) {
|
||||
html = html.replace(pattern, function (str) {
|
||||
return '<!--mce:protected ' + escape(str) + '-->';
|
||||
});
|
||||
});
|
||||
return html;
|
||||
};
|
||||
var unprotectHtml = function (html) {
|
||||
return html.replace(/<!--mce:protected ([\s\S]*?)-->/g, function (a, m) {
|
||||
return unescape(m);
|
||||
});
|
||||
};
|
||||
var Protect = {
|
||||
protectHtml: protectHtml,
|
||||
unprotectHtml: unprotectHtml
|
||||
};
|
||||
|
||||
var each = global$1.each;
|
||||
var low = function (s) {
|
||||
return s.replace(/<\/?[A-Z]+/g, function (a) {
|
||||
return a.toLowerCase();
|
||||
});
|
||||
};
|
||||
var handleSetContent = function (editor, headState, footState, evt) {
|
||||
var startPos, endPos, content, headerFragment, styles = '';
|
||||
var dom = editor.dom;
|
||||
if (evt.selection) {
|
||||
return;
|
||||
}
|
||||
content = Protect.protectHtml(editor.settings.protect, evt.content);
|
||||
if (evt.format === 'raw' && headState.get()) {
|
||||
return;
|
||||
}
|
||||
if (evt.source_view && Settings.shouldHideInSourceView(editor)) {
|
||||
return;
|
||||
}
|
||||
if (content.length === 0 && !evt.source_view) {
|
||||
content = global$1.trim(headState.get()) + '\n' + global$1.trim(content) + '\n' + global$1.trim(footState.get());
|
||||
}
|
||||
content = content.replace(/<(\/?)BODY/gi, '<$1body');
|
||||
startPos = content.indexOf('<body');
|
||||
if (startPos !== -1) {
|
||||
startPos = content.indexOf('>', startPos);
|
||||
headState.set(low(content.substring(0, startPos + 1)));
|
||||
endPos = content.indexOf('</body', startPos);
|
||||
if (endPos === -1) {
|
||||
endPos = content.length;
|
||||
}
|
||||
evt.content = global$1.trim(content.substring(startPos + 1, endPos));
|
||||
footState.set(low(content.substring(endPos)));
|
||||
} else {
|
||||
headState.set(getDefaultHeader(editor));
|
||||
footState.set('\n</body>\n</html>');
|
||||
}
|
||||
headerFragment = Parser.parseHeader(headState.get());
|
||||
each(headerFragment.getAll('style'), function (node) {
|
||||
if (node.firstChild) {
|
||||
styles += node.firstChild.value;
|
||||
}
|
||||
});
|
||||
var bodyElm = headerFragment.getAll('body')[0];
|
||||
if (bodyElm) {
|
||||
dom.setAttribs(editor.getBody(), {
|
||||
style: bodyElm.attr('style') || '',
|
||||
dir: bodyElm.attr('dir') || '',
|
||||
vLink: bodyElm.attr('vlink') || '',
|
||||
link: bodyElm.attr('link') || '',
|
||||
aLink: bodyElm.attr('alink') || ''
|
||||
});
|
||||
}
|
||||
dom.remove('fullpage_styles');
|
||||
var headElm = editor.getDoc().getElementsByTagName('head')[0];
|
||||
if (styles) {
|
||||
var styleElm = dom.add(headElm, 'style', { id: 'fullpage_styles' });
|
||||
styleElm.appendChild(domGlobals.document.createTextNode(styles));
|
||||
}
|
||||
var currentStyleSheetsMap = {};
|
||||
global$1.each(headElm.getElementsByTagName('link'), function (stylesheet) {
|
||||
if (stylesheet.rel === 'stylesheet' && stylesheet.getAttribute('data-mce-fullpage')) {
|
||||
currentStyleSheetsMap[stylesheet.href] = stylesheet;
|
||||
}
|
||||
});
|
||||
global$1.each(headerFragment.getAll('link'), function (stylesheet) {
|
||||
var href = stylesheet.attr('href');
|
||||
if (!href) {
|
||||
return true;
|
||||
}
|
||||
if (!currentStyleSheetsMap[href] && stylesheet.attr('rel') === 'stylesheet') {
|
||||
dom.add(headElm, 'link', {
|
||||
'rel': 'stylesheet',
|
||||
'text': 'text/css',
|
||||
'href': href,
|
||||
'data-mce-fullpage': '1'
|
||||
});
|
||||
}
|
||||
delete currentStyleSheetsMap[href];
|
||||
});
|
||||
global$1.each(currentStyleSheetsMap, function (stylesheet) {
|
||||
stylesheet.parentNode.removeChild(stylesheet);
|
||||
});
|
||||
};
|
||||
var getDefaultHeader = function (editor) {
|
||||
var header = '', value, styles = '';
|
||||
if (Settings.getDefaultXmlPi(editor)) {
|
||||
var piEncoding = Settings.getDefaultEncoding(editor);
|
||||
header += '<?xml version="1.0" encoding="' + (piEncoding ? piEncoding : 'ISO-8859-1') + '" ?>\n';
|
||||
}
|
||||
header += Settings.getDefaultDocType(editor);
|
||||
header += '\n<html>\n<head>\n';
|
||||
if (value = Settings.getDefaultTitle(editor)) {
|
||||
header += '<title>' + value + '</title>\n';
|
||||
}
|
||||
if (value = Settings.getDefaultEncoding(editor)) {
|
||||
header += '<meta http-equiv="Content-Type" content="text/html; charset=' + value + '" />\n';
|
||||
}
|
||||
if (value = Settings.getDefaultFontFamily(editor)) {
|
||||
styles += 'font-family: ' + value + ';';
|
||||
}
|
||||
if (value = Settings.getDefaultFontSize(editor)) {
|
||||
styles += 'font-size: ' + value + ';';
|
||||
}
|
||||
if (value = Settings.getDefaultTextColor(editor)) {
|
||||
styles += 'color: ' + value + ';';
|
||||
}
|
||||
header += '</head>\n<body' + (styles ? ' style="' + styles + '"' : '') + '>\n';
|
||||
return header;
|
||||
};
|
||||
var handleGetContent = function (editor, head, foot, evt) {
|
||||
if (!evt.selection && (!evt.source_view || !Settings.shouldHideInSourceView(editor))) {
|
||||
evt.content = Protect.unprotectHtml(global$1.trim(head) + '\n' + global$1.trim(evt.content) + '\n' + global$1.trim(foot));
|
||||
}
|
||||
};
|
||||
var setup = function (editor, headState, footState) {
|
||||
editor.on('BeforeSetContent', function (evt) {
|
||||
handleSetContent(editor, headState, footState, evt);
|
||||
});
|
||||
editor.on('GetContent', function (evt) {
|
||||
handleGetContent(editor, headState.get(), footState.get(), evt);
|
||||
});
|
||||
};
|
||||
var FilterContent = { setup: setup };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.ui.registry.addButton('fullpage', {
|
||||
tooltip: 'Metadata and document properties',
|
||||
icon: 'document-properties',
|
||||
onAction: function () {
|
||||
editor.execCommand('mceFullPageProperties');
|
||||
}
|
||||
});
|
||||
editor.ui.registry.addMenuItem('fullpage', {
|
||||
text: 'Metadata and document properties',
|
||||
icon: 'document-properties',
|
||||
onAction: function () {
|
||||
editor.execCommand('mceFullPageProperties');
|
||||
}
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
function Plugin () {
|
||||
global.add('fullpage', function (editor) {
|
||||
var headState = Cell(''), footState = Cell('');
|
||||
Commands.register(editor, headState);
|
||||
Buttons.register(editor);
|
||||
FilterContent.setup(editor, headState, footState);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}(window));
|
@ -0,0 +1,908 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var get = function (customTabs) {
|
||||
var addTab = function (spec) {
|
||||
var currentCustomTabs = customTabs.get();
|
||||
currentCustomTabs[spec.name] = spec;
|
||||
customTabs.set(currentCustomTabs);
|
||||
};
|
||||
return { addTab: addTab };
|
||||
};
|
||||
|
||||
var register = function (editor, dialogOpener) {
|
||||
editor.addCommand('mceHelp', dialogOpener);
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var register$1 = function (editor, dialogOpener) {
|
||||
editor.ui.registry.addButton('help', {
|
||||
icon: 'help',
|
||||
tooltip: 'Help',
|
||||
onAction: dialogOpener
|
||||
});
|
||||
editor.ui.registry.addMenuItem('help', {
|
||||
text: 'Help',
|
||||
icon: 'help',
|
||||
shortcut: 'Alt+0',
|
||||
onAction: dialogOpener
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
var __assign = function () {
|
||||
__assign = Object.assign || function __assign(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s)
|
||||
if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
|
||||
var noop = function () {
|
||||
};
|
||||
var constant = function (value) {
|
||||
return function () {
|
||||
return value;
|
||||
};
|
||||
};
|
||||
function curry(fn) {
|
||||
var initialArgs = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
initialArgs[_i - 1] = arguments[_i];
|
||||
}
|
||||
return function () {
|
||||
var restArgs = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
restArgs[_i] = arguments[_i];
|
||||
}
|
||||
var all = initialArgs.concat(restArgs);
|
||||
return fn.apply(null, all);
|
||||
};
|
||||
}
|
||||
var not = function (f) {
|
||||
return function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return !f.apply(null, args);
|
||||
};
|
||||
};
|
||||
var never = constant(false);
|
||||
var always = constant(true);
|
||||
|
||||
var none = function () {
|
||||
return NONE;
|
||||
};
|
||||
var NONE = function () {
|
||||
var eq = function (o) {
|
||||
return o.isNone();
|
||||
};
|
||||
var call = function (thunk) {
|
||||
return thunk();
|
||||
};
|
||||
var id = function (n) {
|
||||
return n;
|
||||
};
|
||||
var me = {
|
||||
fold: function (n, s) {
|
||||
return n();
|
||||
},
|
||||
is: never,
|
||||
isSome: never,
|
||||
isNone: always,
|
||||
getOr: id,
|
||||
getOrThunk: call,
|
||||
getOrDie: function (msg) {
|
||||
throw new Error(msg || 'error: getOrDie called on none.');
|
||||
},
|
||||
getOrNull: constant(null),
|
||||
getOrUndefined: constant(undefined),
|
||||
or: id,
|
||||
orThunk: call,
|
||||
map: none,
|
||||
each: noop,
|
||||
bind: none,
|
||||
exists: never,
|
||||
forall: always,
|
||||
filter: none,
|
||||
equals: eq,
|
||||
equals_: eq,
|
||||
toArray: function () {
|
||||
return [];
|
||||
},
|
||||
toString: constant('none()')
|
||||
};
|
||||
if (Object.freeze) {
|
||||
Object.freeze(me);
|
||||
}
|
||||
return me;
|
||||
}();
|
||||
var some = function (a) {
|
||||
var constant_a = constant(a);
|
||||
var self = function () {
|
||||
return me;
|
||||
};
|
||||
var bind = function (f) {
|
||||
return f(a);
|
||||
};
|
||||
var me = {
|
||||
fold: function (n, s) {
|
||||
return s(a);
|
||||
},
|
||||
is: function (v) {
|
||||
return a === v;
|
||||
},
|
||||
isSome: always,
|
||||
isNone: never,
|
||||
getOr: constant_a,
|
||||
getOrThunk: constant_a,
|
||||
getOrDie: constant_a,
|
||||
getOrNull: constant_a,
|
||||
getOrUndefined: constant_a,
|
||||
or: self,
|
||||
orThunk: self,
|
||||
map: function (f) {
|
||||
return some(f(a));
|
||||
},
|
||||
each: function (f) {
|
||||
f(a);
|
||||
},
|
||||
bind: bind,
|
||||
exists: bind,
|
||||
forall: bind,
|
||||
filter: function (f) {
|
||||
return f(a) ? me : NONE;
|
||||
},
|
||||
toArray: function () {
|
||||
return [a];
|
||||
},
|
||||
toString: function () {
|
||||
return 'some(' + a + ')';
|
||||
},
|
||||
equals: function (o) {
|
||||
return o.is(a);
|
||||
},
|
||||
equals_: function (o, elementEq) {
|
||||
return o.fold(never, function (b) {
|
||||
return elementEq(a, b);
|
||||
});
|
||||
}
|
||||
};
|
||||
return me;
|
||||
};
|
||||
var from = function (value) {
|
||||
return value === null || value === undefined ? NONE : some(value);
|
||||
};
|
||||
var Option = {
|
||||
some: some,
|
||||
none: none,
|
||||
from: from
|
||||
};
|
||||
|
||||
var typeOf = function (x) {
|
||||
if (x === null) {
|
||||
return 'null';
|
||||
}
|
||||
var t = typeof x;
|
||||
if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
|
||||
return 'array';
|
||||
}
|
||||
if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
|
||||
return 'string';
|
||||
}
|
||||
return t;
|
||||
};
|
||||
var isType = function (type) {
|
||||
return function (value) {
|
||||
return typeOf(value) === type;
|
||||
};
|
||||
};
|
||||
var isFunction = isType('function');
|
||||
|
||||
var nativeSlice = Array.prototype.slice;
|
||||
var nativeIndexOf = Array.prototype.indexOf;
|
||||
var rawIndexOf = function (ts, t) {
|
||||
return nativeIndexOf.call(ts, t);
|
||||
};
|
||||
var indexOf = function (xs, x) {
|
||||
var r = rawIndexOf(xs, x);
|
||||
return r === -1 ? Option.none() : Option.some(r);
|
||||
};
|
||||
var contains = function (xs, x) {
|
||||
return rawIndexOf(xs, x) > -1;
|
||||
};
|
||||
var map = function (xs, f) {
|
||||
var len = xs.length;
|
||||
var r = new Array(len);
|
||||
for (var i = 0; i < len; i++) {
|
||||
var x = xs[i];
|
||||
r[i] = f(x, i);
|
||||
}
|
||||
return r;
|
||||
};
|
||||
var filter = function (xs, pred) {
|
||||
var r = [];
|
||||
for (var i = 0, len = xs.length; i < len; i++) {
|
||||
var x = xs[i];
|
||||
if (pred(x, i)) {
|
||||
r.push(x);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
};
|
||||
var find = function (xs, pred) {
|
||||
for (var i = 0, len = xs.length; i < len; i++) {
|
||||
var x = xs[i];
|
||||
if (pred(x, i)) {
|
||||
return Option.some(x);
|
||||
}
|
||||
}
|
||||
return Option.none();
|
||||
};
|
||||
var from$1 = isFunction(Array.from) ? Array.from : function (x) {
|
||||
return nativeSlice.call(x);
|
||||
};
|
||||
|
||||
var keys = Object.keys;
|
||||
var hasOwnProperty = Object.hasOwnProperty;
|
||||
var get$1 = function (obj, key) {
|
||||
return has(obj, key) ? Option.from(obj[key]) : Option.none();
|
||||
};
|
||||
var has = function (obj, key) {
|
||||
return hasOwnProperty.call(obj, key);
|
||||
};
|
||||
|
||||
var cat = function (arr) {
|
||||
var r = [];
|
||||
var push = function (x) {
|
||||
r.push(x);
|
||||
};
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
arr[i].each(push);
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
var getHelpTabs = function (editor) {
|
||||
return Option.from(editor.getParam('help_tabs'));
|
||||
};
|
||||
|
||||
var shortcuts = [
|
||||
{
|
||||
shortcuts: ['Meta + B'],
|
||||
action: 'Bold'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Meta + I'],
|
||||
action: 'Italic'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Meta + U'],
|
||||
action: 'Underline'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Meta + A'],
|
||||
action: 'Select all'
|
||||
},
|
||||
{
|
||||
shortcuts: [
|
||||
'Meta + Y',
|
||||
'Meta + Shift + Z'
|
||||
],
|
||||
action: 'Redo'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Meta + Z'],
|
||||
action: 'Undo'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Access + 1'],
|
||||
action: 'Header 1'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Access + 2'],
|
||||
action: 'Header 2'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Access + 3'],
|
||||
action: 'Header 3'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Access + 4'],
|
||||
action: 'Header 4'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Access + 5'],
|
||||
action: 'Header 5'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Access + 6'],
|
||||
action: 'Header 6'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Access + 7'],
|
||||
action: 'Paragraph'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Access + 8'],
|
||||
action: 'Div'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Access + 9'],
|
||||
action: 'Address'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Alt + 0'],
|
||||
action: 'Open help dialog'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Alt + F9'],
|
||||
action: 'Focus to menubar'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Alt + F10'],
|
||||
action: 'Focus to toolbar'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Alt + F11'],
|
||||
action: 'Focus to element path'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Ctrl + F9'],
|
||||
action: 'Focus to contextual toolbar'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Shift + Enter'],
|
||||
action: 'Open popup menu for split buttons'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Meta + K'],
|
||||
action: 'Insert link (if link plugin activated)'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Meta + S'],
|
||||
action: 'Save (if save plugin activated)'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Meta + F'],
|
||||
action: 'Find (if searchreplace plugin activated)'
|
||||
},
|
||||
{
|
||||
shortcuts: ['Meta + Shift + F'],
|
||||
action: 'Switch to or from fullscreen mode'
|
||||
}
|
||||
];
|
||||
var KeyboardShortcuts = { shortcuts: shortcuts };
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var convertText = function (source) {
|
||||
var mac = {
|
||||
alt: '⌥',
|
||||
ctrl: '⌃',
|
||||
shift: '⇧',
|
||||
meta: '⌘',
|
||||
access: '⌃⌥'
|
||||
};
|
||||
var other = {
|
||||
meta: 'Ctrl ',
|
||||
access: 'Shift + Alt '
|
||||
};
|
||||
var replace = global$1.mac ? mac : other;
|
||||
var shortcut = source.split('+');
|
||||
var updated = map(shortcut, function (segment) {
|
||||
var search = segment.toLowerCase().trim();
|
||||
return has(replace, search) ? replace[search] : segment;
|
||||
});
|
||||
return global$1.mac ? updated.join('').replace(/\s/, '') : updated.join('+');
|
||||
};
|
||||
var ConvertShortcut = { convertText: convertText };
|
||||
|
||||
var tab = function () {
|
||||
var shortcutList = map(KeyboardShortcuts.shortcuts, function (shortcut) {
|
||||
var shortcutText = map(shortcut.shortcuts, ConvertShortcut.convertText).join(' or ');
|
||||
return [
|
||||
shortcut.action,
|
||||
shortcutText
|
||||
];
|
||||
});
|
||||
var tablePanel = {
|
||||
type: 'table',
|
||||
header: [
|
||||
'Action',
|
||||
'Shortcut'
|
||||
],
|
||||
cells: shortcutList
|
||||
};
|
||||
return {
|
||||
name: 'shortcuts',
|
||||
title: 'Handy Shortcuts',
|
||||
items: [tablePanel]
|
||||
};
|
||||
};
|
||||
var KeyboardShortcutsTab = { tab: tab };
|
||||
|
||||
var supplant = function (str, obj) {
|
||||
var isStringOrNumber = function (a) {
|
||||
var t = typeof a;
|
||||
return t === 'string' || t === 'number';
|
||||
};
|
||||
return str.replace(/\$\{([^{}]*)\}/g, function (fullMatch, key) {
|
||||
var value = obj[key];
|
||||
return isStringOrNumber(value) ? value.toString() : fullMatch;
|
||||
});
|
||||
};
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.util.I18n');
|
||||
|
||||
var urls = [
|
||||
{
|
||||
key: 'advlist',
|
||||
name: 'Advanced List'
|
||||
},
|
||||
{
|
||||
key: 'anchor',
|
||||
name: 'Anchor'
|
||||
},
|
||||
{
|
||||
key: 'autolink',
|
||||
name: 'Autolink'
|
||||
},
|
||||
{
|
||||
key: 'autoresize',
|
||||
name: 'Autoresize'
|
||||
},
|
||||
{
|
||||
key: 'autosave',
|
||||
name: 'Autosave'
|
||||
},
|
||||
{
|
||||
key: 'bbcode',
|
||||
name: 'BBCode'
|
||||
},
|
||||
{
|
||||
key: 'charmap',
|
||||
name: 'Character Map'
|
||||
},
|
||||
{
|
||||
key: 'code',
|
||||
name: 'Code'
|
||||
},
|
||||
{
|
||||
key: 'codesample',
|
||||
name: 'Code Sample'
|
||||
},
|
||||
{
|
||||
key: 'colorpicker',
|
||||
name: 'Color Picker'
|
||||
},
|
||||
{
|
||||
key: 'directionality',
|
||||
name: 'Directionality'
|
||||
},
|
||||
{
|
||||
key: 'emoticons',
|
||||
name: 'Emoticons'
|
||||
},
|
||||
{
|
||||
key: 'fullpage',
|
||||
name: 'Full Page'
|
||||
},
|
||||
{
|
||||
key: 'fullscreen',
|
||||
name: 'Full Screen'
|
||||
},
|
||||
{
|
||||
key: 'help',
|
||||
name: 'Help'
|
||||
},
|
||||
{
|
||||
key: 'hr',
|
||||
name: 'Horizontal Rule'
|
||||
},
|
||||
{
|
||||
key: 'image',
|
||||
name: 'Image'
|
||||
},
|
||||
{
|
||||
key: 'imagetools',
|
||||
name: 'Image Tools'
|
||||
},
|
||||
{
|
||||
key: 'importcss',
|
||||
name: 'Import CSS'
|
||||
},
|
||||
{
|
||||
key: 'insertdatetime',
|
||||
name: 'Insert Date/Time'
|
||||
},
|
||||
{
|
||||
key: 'legacyoutput',
|
||||
name: 'Legacy Output'
|
||||
},
|
||||
{
|
||||
key: 'link',
|
||||
name: 'Link'
|
||||
},
|
||||
{
|
||||
key: 'lists',
|
||||
name: 'Lists'
|
||||
},
|
||||
{
|
||||
key: 'media',
|
||||
name: 'Media'
|
||||
},
|
||||
{
|
||||
key: 'nonbreaking',
|
||||
name: 'Nonbreaking'
|
||||
},
|
||||
{
|
||||
key: 'noneditable',
|
||||
name: 'Noneditable'
|
||||
},
|
||||
{
|
||||
key: 'pagebreak',
|
||||
name: 'Page Break'
|
||||
},
|
||||
{
|
||||
key: 'paste',
|
||||
name: 'Paste'
|
||||
},
|
||||
{
|
||||
key: 'preview',
|
||||
name: 'Preview'
|
||||
},
|
||||
{
|
||||
key: 'print',
|
||||
name: 'Print'
|
||||
},
|
||||
{
|
||||
key: 'save',
|
||||
name: 'Save'
|
||||
},
|
||||
{
|
||||
key: 'searchreplace',
|
||||
name: 'Search and Replace'
|
||||
},
|
||||
{
|
||||
key: 'spellchecker',
|
||||
name: 'Spell Checker'
|
||||
},
|
||||
{
|
||||
key: 'tabfocus',
|
||||
name: 'Tab Focus'
|
||||
},
|
||||
{
|
||||
key: 'table',
|
||||
name: 'Table'
|
||||
},
|
||||
{
|
||||
key: 'template',
|
||||
name: 'Template'
|
||||
},
|
||||
{
|
||||
key: 'textcolor',
|
||||
name: 'Text Color'
|
||||
},
|
||||
{
|
||||
key: 'textpattern',
|
||||
name: 'Text Pattern'
|
||||
},
|
||||
{
|
||||
key: 'toc',
|
||||
name: 'Table of Contents'
|
||||
},
|
||||
{
|
||||
key: 'visualblocks',
|
||||
name: 'Visual Blocks'
|
||||
},
|
||||
{
|
||||
key: 'visualchars',
|
||||
name: 'Visual Characters'
|
||||
},
|
||||
{
|
||||
key: 'wordcount',
|
||||
name: 'Word Count'
|
||||
},
|
||||
{
|
||||
key: 'advcode',
|
||||
name: 'Advanced Code Editor*'
|
||||
},
|
||||
{
|
||||
key: 'formatpainter',
|
||||
name: 'Format Painter*'
|
||||
},
|
||||
{
|
||||
key: 'powerpaste',
|
||||
name: 'PowerPaste*'
|
||||
},
|
||||
{
|
||||
key: 'tinydrive',
|
||||
name: 'Tiny Drive*'
|
||||
},
|
||||
{
|
||||
key: 'tinymcespellchecker',
|
||||
name: 'Spell Checker Pro*'
|
||||
},
|
||||
{
|
||||
key: 'a11ychecker',
|
||||
name: 'Accessibility Checker*'
|
||||
},
|
||||
{
|
||||
key: 'linkchecker',
|
||||
name: 'Link Checker*'
|
||||
},
|
||||
{
|
||||
key: 'mentions',
|
||||
name: 'Mentions*'
|
||||
},
|
||||
{
|
||||
key: 'mediaembed',
|
||||
name: 'Enhanced Media Embed*'
|
||||
},
|
||||
{
|
||||
key: 'checklist',
|
||||
name: 'Checklist*'
|
||||
},
|
||||
{
|
||||
key: 'casechange',
|
||||
name: 'Case Change*'
|
||||
},
|
||||
{
|
||||
key: 'permanentpen',
|
||||
name: 'Permanent Pen*'
|
||||
},
|
||||
{
|
||||
key: 'pageembed',
|
||||
name: 'Page Embed*'
|
||||
},
|
||||
{
|
||||
key: 'tinycomments',
|
||||
name: 'Tiny Comments*'
|
||||
},
|
||||
{
|
||||
key: 'advtable',
|
||||
name: 'Advanced Tables*'
|
||||
},
|
||||
{
|
||||
key: 'autocorrect',
|
||||
name: 'Autocorrect*'
|
||||
}
|
||||
];
|
||||
var PluginUrls = { urls: urls };
|
||||
|
||||
var tab$1 = function (editor) {
|
||||
var availablePlugins = function () {
|
||||
var premiumPlugins = [
|
||||
'Accessibility Checker',
|
||||
'Advanced Code Editor',
|
||||
'Advanced Tables',
|
||||
'Case Change',
|
||||
'Checklist',
|
||||
'Tiny Comments',
|
||||
'Tiny Drive',
|
||||
'Enhanced Media Embed',
|
||||
'Format Painter',
|
||||
'Link Checker',
|
||||
'Mentions',
|
||||
'MoxieManager',
|
||||
'Page Embed',
|
||||
'Permanent Pen',
|
||||
'PowerPaste',
|
||||
'Spell Checker Pro'
|
||||
];
|
||||
var premiumPluginList = map(premiumPlugins, function (plugin) {
|
||||
return '<li>' + global$2.translate(plugin) + '</li>';
|
||||
}).join('');
|
||||
return '<div data-mce-tabstop="1" tabindex="-1">' + '<p><b>' + global$2.translate('Premium plugins:') + '</b></p>' + '<ul>' + premiumPluginList + '<li class="tox-help__more-link" "><a href="https://www.tiny.cloud/pricing/?utm_campaign=editor_referral&utm_medium=help_dialog&utm_source=tinymce" target="_blank">' + global$2.translate('Learn more...') + '</a></li>' + '</ul>' + '</div>';
|
||||
};
|
||||
var makeLink = curry(supplant, '<a href="${url}" target="_blank" rel="noopener">${name}</a>');
|
||||
var maybeUrlize = function (editor, key) {
|
||||
return find(PluginUrls.urls, function (x) {
|
||||
return x.key === key;
|
||||
}).fold(function () {
|
||||
var getMetadata = editor.plugins[key].getMetadata;
|
||||
return typeof getMetadata === 'function' ? makeLink(getMetadata()) : key;
|
||||
}, function (x) {
|
||||
return makeLink({
|
||||
name: x.name,
|
||||
url: 'https://www.tiny.cloud/docs/plugins/' + x.key
|
||||
});
|
||||
});
|
||||
};
|
||||
var getPluginKeys = function (editor) {
|
||||
var keys$1 = keys(editor.plugins);
|
||||
return editor.settings.forced_plugins === undefined ? keys$1 : filter(keys$1, not(curry(contains, editor.settings.forced_plugins)));
|
||||
};
|
||||
var pluginLister = function (editor) {
|
||||
var pluginKeys = getPluginKeys(editor);
|
||||
var pluginLis = map(pluginKeys, function (key) {
|
||||
return '<li>' + maybeUrlize(editor, key) + '</li>';
|
||||
});
|
||||
var count = pluginLis.length;
|
||||
var pluginsString = pluginLis.join('');
|
||||
var html = '<p><b>' + global$2.translate([
|
||||
'Plugins installed ({0}):',
|
||||
count
|
||||
]) + '</b></p>' + '<ul>' + pluginsString + '</ul>';
|
||||
return html;
|
||||
};
|
||||
var installedPlugins = function (editor) {
|
||||
if (editor == null) {
|
||||
return '';
|
||||
}
|
||||
return '<div data-mce-tabstop="1" tabindex="-1">' + pluginLister(editor) + '</div>';
|
||||
};
|
||||
var htmlPanel = {
|
||||
type: 'htmlpanel',
|
||||
presets: 'document',
|
||||
html: [
|
||||
installedPlugins(editor),
|
||||
availablePlugins()
|
||||
].join('')
|
||||
};
|
||||
return {
|
||||
name: 'plugins',
|
||||
title: 'Plugins',
|
||||
items: [htmlPanel]
|
||||
};
|
||||
};
|
||||
var PluginsTab = { tab: tab$1 };
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.EditorManager');
|
||||
|
||||
var tab$2 = function () {
|
||||
var getVersion = function (major, minor) {
|
||||
return major.indexOf('@') === 0 ? 'X.X.X' : major + '.' + minor;
|
||||
};
|
||||
var version = getVersion(global$3.majorVersion, global$3.minorVersion);
|
||||
var changeLogLink = '<a href="https://www.tinymce.com/docs/changelog/?utm_campaign=editor_referral&utm_medium=help_dialog&utm_source=tinymce" target="_blank">TinyMCE ' + version + '</a>';
|
||||
var htmlPanel = {
|
||||
type: 'htmlpanel',
|
||||
html: '<p>' + global$2.translate([
|
||||
'You are using {0}',
|
||||
changeLogLink
|
||||
]) + '</p>',
|
||||
presets: 'document'
|
||||
};
|
||||
return {
|
||||
name: 'versions',
|
||||
title: 'Version',
|
||||
items: [htmlPanel]
|
||||
};
|
||||
};
|
||||
var VersionTab = { tab: tab$2 };
|
||||
|
||||
var description = '<h1>Editor UI keyboard navigation</h1>\n\n<h2>Activating keyboard navigation</h2>\n\n<p>The sections of the outer UI of the editor - the menubar, toolbar, sidebar and footer - are all keyboard navigable. As such, there are multiple ways to activate keyboard navigation:</p>\n<ul>\n <li>Focus the menubar: Alt + F9 (Windows) or ⌥F9 (MacOS)</li>\n <li>Focus the toolbar: Alt + F10 (Windows) or ⌥F10 (MacOS)</li>\n <li>Focus the footer: Alt + F11 (Windows) or ⌥F11 (MacOS)</li>\n</ul>\n\n<p>Focusing the menubar or toolbar will start keyboard navigation at the first item in the menubar or toolbar, which will be highlighted with a gray background. Focusing the footer will start keyboard navigation at the first item in the element path, which will be highlighted with an underline. </p>\n\n<h2>Moving between UI sections</h2>\n\n<p>When keyboard navigation is active, pressing tab will move the focus to the next major section of the UI, where applicable. These sections are:</p>\n<ul>\n <li>the menubar</li>\n <li>each group of the toolbar </li>\n <li>the sidebar</li>\n <li>the element path in the footer </li>\n <li>the wordcount toggle button in the footer </li>\n <li>the branding link in the footer </li>\n</ul>\n\n<p>Pressing shift + tab will move backwards through the same sections, except when moving from the footer to the toolbar. Focusing the element path then pressing shift + tab will move focus to the first toolbar group, not the last.</p>\n\n<h2>Moving within UI sections</h2>\n\n<p>Keyboard navigation within UI sections can usually be achieved using the left and right arrow keys. This includes:</p>\n<ul>\n <li>moving between menus in the menubar</li>\n <li>moving between buttons in a toolbar group</li>\n <li>moving between items in the element path</li>\n</ul>\n\n<p>In all these UI sections, keyboard navigation will cycle within the section. For example, focusing the last button in a toolbar group then pressing right arrow will move focus to the first item in the same toolbar group. </p>\n\n<h1>Executing buttons</h1>\n\n<p>To execute a button, navigate the selection to the desired button and hit space or enter.</p>\n\n<h1>Opening, navigating and closing menus</h1>\n\n<p>When focusing a menubar button or a toolbar button with a menu, pressing space, enter or down arrow will open the menu. When the menu opens the first item will be selected. To move up or down the menu, press the up or down arrow key respectively. This is the same for submenus, which can also be opened and closed using the left and right arrow keys.</p>\n\n<p>To close any active menu, hit the escape key. When a menu is closed the selection will be restored to its previous selection. This also works for closing submenus.</p>\n\n<h1>Context toolbars and menus</h1>\n\n<p>To focus an open context toolbar such as the table context toolbar, press Ctrl + F9 (Windows) or ⌃F9 (MacOS).</p>\n\n<p>Context toolbar navigation is the same as toolbar navigation, and context menu navigation is the same as standard menu navigation.</p>\n\n<h1>Dialog navigation</h1>\n\n<p>There are two types of dialog UIs in TinyMCE: tabbed dialogs and non-tabbed dialogs.</p>\n\n<p>When a non-tabbed dialog is opened, the first interactive component in the dialog will be focused. Users can navigate between interactive components by pressing tab. This includes any footer buttons. Navigation will cycle back to the first dialog component if tab is pressed while focusing the last component in the dialog. Pressing shift + tab will navigate backwards.</p>\n\n<p>When a tabbed dialog is opened, the first button in the tab menu is focused. Pressing tab will navigate to the first interactive component in that tab, and will cycle through the tab\u2019s components, the footer buttons, then back to the tab button. To switch to another tab, focus the tab button for the current tab, then use the arrow keys to cycle through the tab buttons.</p>';
|
||||
var tab$3 = function () {
|
||||
var body = {
|
||||
type: 'htmlpanel',
|
||||
presets: 'document',
|
||||
html: description
|
||||
};
|
||||
return {
|
||||
name: 'keyboardnav',
|
||||
title: 'Keyboard Navigation',
|
||||
items: [body]
|
||||
};
|
||||
};
|
||||
var KeyboardNavTab = { tab: tab$3 };
|
||||
|
||||
var parseHelpTabsSetting = function (tabsFromSettings, tabs) {
|
||||
var newTabs = {};
|
||||
var names = map(tabsFromSettings, function (t) {
|
||||
if (typeof t === 'string') {
|
||||
if (has(tabs, t)) {
|
||||
newTabs[t] = tabs[t];
|
||||
}
|
||||
return t;
|
||||
} else {
|
||||
newTabs[t.name] = t;
|
||||
return t.name;
|
||||
}
|
||||
});
|
||||
return {
|
||||
tabs: newTabs,
|
||||
names: names
|
||||
};
|
||||
};
|
||||
var getNamesFromTabs = function (tabs) {
|
||||
var names = keys(tabs);
|
||||
var versionsIdx = indexOf(names, 'versions');
|
||||
versionsIdx.each(function (idx) {
|
||||
names.splice(idx, 1);
|
||||
names.push('versions');
|
||||
});
|
||||
return {
|
||||
tabs: tabs,
|
||||
names: names
|
||||
};
|
||||
};
|
||||
var parseCustomTabs = function (editor, customTabs) {
|
||||
var _a;
|
||||
var shortcuts = KeyboardShortcutsTab.tab();
|
||||
var nav = KeyboardNavTab.tab();
|
||||
var plugins = PluginsTab.tab(editor);
|
||||
var versions = VersionTab.tab();
|
||||
var tabs = __assign((_a = {}, _a[shortcuts.name] = shortcuts, _a[nav.name] = nav, _a[plugins.name] = plugins, _a[versions.name] = versions, _a), customTabs.get());
|
||||
return getHelpTabs(editor).fold(function () {
|
||||
return getNamesFromTabs(tabs);
|
||||
}, function (tabsFromSettings) {
|
||||
return parseHelpTabsSetting(tabsFromSettings, tabs);
|
||||
});
|
||||
};
|
||||
var init = function (editor, customTabs) {
|
||||
return function () {
|
||||
var _a = parseCustomTabs(editor, customTabs), tabs = _a.tabs, names = _a.names;
|
||||
var foundTabs = map(names, function (name) {
|
||||
return get$1(tabs, name);
|
||||
});
|
||||
var dialogTabs = cat(foundTabs);
|
||||
var body = {
|
||||
type: 'tabpanel',
|
||||
tabs: dialogTabs
|
||||
};
|
||||
editor.windowManager.open({
|
||||
title: 'Help',
|
||||
size: 'medium',
|
||||
body: body,
|
||||
buttons: [{
|
||||
type: 'cancel',
|
||||
name: 'close',
|
||||
text: 'Close',
|
||||
primary: true
|
||||
}],
|
||||
initialData: {}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
function Plugin () {
|
||||
global.add('help', function (editor) {
|
||||
var customTabs = Cell({});
|
||||
var api = get(customTabs);
|
||||
var dialogOpener = init(editor, customTabs);
|
||||
Buttons.register(editor, dialogOpener);
|
||||
Commands.register(editor, dialogOpener);
|
||||
editor.shortcuts.add('Alt+0', 'Open help dialog', 'mceHelp');
|
||||
return api;
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('InsertHorizontalRule', function () {
|
||||
editor.execCommand('mceInsertContent', false, '<hr />');
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.ui.registry.addButton('hr', {
|
||||
icon: 'horizontal-rule',
|
||||
tooltip: 'Horizontal line',
|
||||
onAction: function () {
|
||||
return editor.execCommand('InsertHorizontalRule');
|
||||
}
|
||||
});
|
||||
editor.ui.registry.addMenuItem('hr', {
|
||||
icon: 'horizontal-rule',
|
||||
text: 'Horizontal line',
|
||||
onAction: function () {
|
||||
return editor.execCommand('InsertHorizontalRule');
|
||||
}
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
function Plugin () {
|
||||
global.add('hr', function (editor) {
|
||||
Commands.register(editor);
|
||||
Buttons.register(editor);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=function(n){n.addCommand("InsertHorizontalRule",function(){n.execCommand("mceInsertContent",!1,"<hr />")})},t=function(n){n.ui.registry.addButton("hr",{icon:"horizontal-rule",tooltip:"Horizontal line",onAction:function(){return n.execCommand("InsertHorizontalRule")}}),n.ui.registry.addMenuItem("hr",{icon:"horizontal-rule",text:"Horizontal line",onAction:function(){return n.execCommand("InsertHorizontalRule")}})};!function e(){n.add("hr",function(n){o(n),t(n)})}()}();
|
@ -0,0 +1,407 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.EditorManager');
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var shouldMergeClasses = function (editor) {
|
||||
return editor.getParam('importcss_merge_classes');
|
||||
};
|
||||
var shouldImportExclusive = function (editor) {
|
||||
return editor.getParam('importcss_exclusive');
|
||||
};
|
||||
var getSelectorConverter = function (editor) {
|
||||
return editor.getParam('importcss_selector_converter');
|
||||
};
|
||||
var getSelectorFilter = function (editor) {
|
||||
return editor.getParam('importcss_selector_filter');
|
||||
};
|
||||
var getCssGroups = function (editor) {
|
||||
return editor.getParam('importcss_groups');
|
||||
};
|
||||
var shouldAppend = function (editor) {
|
||||
return editor.getParam('importcss_append');
|
||||
};
|
||||
var getFileFilter = function (editor) {
|
||||
return editor.getParam('importcss_file_filter');
|
||||
};
|
||||
var Settings = {
|
||||
shouldMergeClasses: shouldMergeClasses,
|
||||
shouldImportExclusive: shouldImportExclusive,
|
||||
getSelectorConverter: getSelectorConverter,
|
||||
getSelectorFilter: getSelectorFilter,
|
||||
getCssGroups: getCssGroups,
|
||||
shouldAppend: shouldAppend,
|
||||
getFileFilter: getFileFilter
|
||||
};
|
||||
|
||||
var noop = function () {
|
||||
};
|
||||
var constant = function (value) {
|
||||
return function () {
|
||||
return value;
|
||||
};
|
||||
};
|
||||
var never = constant(false);
|
||||
var always = constant(true);
|
||||
|
||||
var none = function () {
|
||||
return NONE;
|
||||
};
|
||||
var NONE = function () {
|
||||
var eq = function (o) {
|
||||
return o.isNone();
|
||||
};
|
||||
var call = function (thunk) {
|
||||
return thunk();
|
||||
};
|
||||
var id = function (n) {
|
||||
return n;
|
||||
};
|
||||
var me = {
|
||||
fold: function (n, s) {
|
||||
return n();
|
||||
},
|
||||
is: never,
|
||||
isSome: never,
|
||||
isNone: always,
|
||||
getOr: id,
|
||||
getOrThunk: call,
|
||||
getOrDie: function (msg) {
|
||||
throw new Error(msg || 'error: getOrDie called on none.');
|
||||
},
|
||||
getOrNull: constant(null),
|
||||
getOrUndefined: constant(undefined),
|
||||
or: id,
|
||||
orThunk: call,
|
||||
map: none,
|
||||
each: noop,
|
||||
bind: none,
|
||||
exists: never,
|
||||
forall: always,
|
||||
filter: none,
|
||||
equals: eq,
|
||||
equals_: eq,
|
||||
toArray: function () {
|
||||
return [];
|
||||
},
|
||||
toString: constant('none()')
|
||||
};
|
||||
if (Object.freeze) {
|
||||
Object.freeze(me);
|
||||
}
|
||||
return me;
|
||||
}();
|
||||
|
||||
var typeOf = function (x) {
|
||||
if (x === null) {
|
||||
return 'null';
|
||||
}
|
||||
var t = typeof x;
|
||||
if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
|
||||
return 'array';
|
||||
}
|
||||
if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
|
||||
return 'string';
|
||||
}
|
||||
return t;
|
||||
};
|
||||
var isType = function (type) {
|
||||
return function (value) {
|
||||
return typeOf(value) === type;
|
||||
};
|
||||
};
|
||||
var isArray = isType('array');
|
||||
var isFunction = isType('function');
|
||||
|
||||
var nativeSlice = Array.prototype.slice;
|
||||
var nativePush = Array.prototype.push;
|
||||
var map = function (xs, f) {
|
||||
var len = xs.length;
|
||||
var r = new Array(len);
|
||||
for (var i = 0; i < len; i++) {
|
||||
var x = xs[i];
|
||||
r[i] = f(x, i);
|
||||
}
|
||||
return r;
|
||||
};
|
||||
var flatten = function (xs) {
|
||||
var r = [];
|
||||
for (var i = 0, len = xs.length; i < len; ++i) {
|
||||
if (!isArray(xs[i])) {
|
||||
throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
|
||||
}
|
||||
nativePush.apply(r, xs[i]);
|
||||
}
|
||||
return r;
|
||||
};
|
||||
var bind = function (xs, f) {
|
||||
return flatten(map(xs, f));
|
||||
};
|
||||
var from = isFunction(Array.from) ? Array.from : function (x) {
|
||||
return nativeSlice.call(x);
|
||||
};
|
||||
|
||||
var generate = function () {
|
||||
var ungroupedOrder = [];
|
||||
var groupOrder = [];
|
||||
var groups = {};
|
||||
var addItemToGroup = function (groupTitle, itemInfo) {
|
||||
if (groups[groupTitle]) {
|
||||
groups[groupTitle].push(itemInfo);
|
||||
} else {
|
||||
groupOrder.push(groupTitle);
|
||||
groups[groupTitle] = [itemInfo];
|
||||
}
|
||||
};
|
||||
var addItem = function (itemInfo) {
|
||||
ungroupedOrder.push(itemInfo);
|
||||
};
|
||||
var toFormats = function () {
|
||||
var groupItems = bind(groupOrder, function (g) {
|
||||
var items = groups[g];
|
||||
return items.length === 0 ? [] : [{
|
||||
title: g,
|
||||
items: items
|
||||
}];
|
||||
});
|
||||
return groupItems.concat(ungroupedOrder);
|
||||
};
|
||||
return {
|
||||
addItemToGroup: addItemToGroup,
|
||||
addItem: addItem,
|
||||
toFormats: toFormats
|
||||
};
|
||||
};
|
||||
|
||||
var removeCacheSuffix = function (url) {
|
||||
var cacheSuffix = global$3.cacheSuffix;
|
||||
if (typeof url === 'string') {
|
||||
url = url.replace('?' + cacheSuffix, '').replace('&' + cacheSuffix, '');
|
||||
}
|
||||
return url;
|
||||
};
|
||||
var isSkinContentCss = function (editor, href) {
|
||||
var settings = editor.settings, skin = settings.skin !== false ? settings.skin || 'oxide' : false;
|
||||
if (skin) {
|
||||
var skinUrl = settings.skin_url ? editor.documentBaseURI.toAbsolute(settings.skin_url) : global$2.baseURL + '/skins/ui/' + skin;
|
||||
var contentSkinUrlPart = global$2.baseURL + '/skins/content/';
|
||||
return href === skinUrl + '/content' + (editor.inline ? '.inline' : '') + '.min.css' || href.indexOf(contentSkinUrlPart) !== -1;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
var compileFilter = function (filter) {
|
||||
if (typeof filter === 'string') {
|
||||
return function (value) {
|
||||
return value.indexOf(filter) !== -1;
|
||||
};
|
||||
} else if (filter instanceof RegExp) {
|
||||
return function (value) {
|
||||
return filter.test(value);
|
||||
};
|
||||
}
|
||||
return filter;
|
||||
};
|
||||
var getSelectors = function (editor, doc, fileFilter) {
|
||||
var selectors = [], contentCSSUrls = {};
|
||||
function append(styleSheet, imported) {
|
||||
var href = styleSheet.href, rules;
|
||||
href = removeCacheSuffix(href);
|
||||
if (!href || !fileFilter(href, imported) || isSkinContentCss(editor, href)) {
|
||||
return;
|
||||
}
|
||||
global$4.each(styleSheet.imports, function (styleSheet) {
|
||||
append(styleSheet, true);
|
||||
});
|
||||
try {
|
||||
rules = styleSheet.cssRules || styleSheet.rules;
|
||||
} catch (e) {
|
||||
}
|
||||
global$4.each(rules, function (cssRule) {
|
||||
if (cssRule.styleSheet) {
|
||||
append(cssRule.styleSheet, true);
|
||||
} else if (cssRule.selectorText) {
|
||||
global$4.each(cssRule.selectorText.split(','), function (selector) {
|
||||
selectors.push(global$4.trim(selector));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
global$4.each(editor.contentCSS, function (url) {
|
||||
contentCSSUrls[url] = true;
|
||||
});
|
||||
if (!fileFilter) {
|
||||
fileFilter = function (href, imported) {
|
||||
return imported || contentCSSUrls[href];
|
||||
};
|
||||
}
|
||||
try {
|
||||
global$4.each(doc.styleSheets, function (styleSheet) {
|
||||
append(styleSheet);
|
||||
});
|
||||
} catch (e) {
|
||||
}
|
||||
return selectors;
|
||||
};
|
||||
var defaultConvertSelectorToFormat = function (editor, selectorText) {
|
||||
var format;
|
||||
var selector = /^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(selectorText);
|
||||
if (!selector) {
|
||||
return;
|
||||
}
|
||||
var elementName = selector[1];
|
||||
var classes = selector[2].substr(1).split('.').join(' ');
|
||||
var inlineSelectorElements = global$4.makeMap('a,img');
|
||||
if (selector[1]) {
|
||||
format = { title: selectorText };
|
||||
if (editor.schema.getTextBlockElements()[elementName]) {
|
||||
format.block = elementName;
|
||||
} else if (editor.schema.getBlockElements()[elementName] || inlineSelectorElements[elementName.toLowerCase()]) {
|
||||
format.selector = elementName;
|
||||
} else {
|
||||
format.inline = elementName;
|
||||
}
|
||||
} else if (selector[2]) {
|
||||
format = {
|
||||
inline: 'span',
|
||||
title: selectorText.substr(1),
|
||||
classes: classes
|
||||
};
|
||||
}
|
||||
if (Settings.shouldMergeClasses(editor) !== false) {
|
||||
format.classes = classes;
|
||||
} else {
|
||||
format.attributes = { class: classes };
|
||||
}
|
||||
return format;
|
||||
};
|
||||
var getGroupsBySelector = function (groups, selector) {
|
||||
return global$4.grep(groups, function (group) {
|
||||
return !group.filter || group.filter(selector);
|
||||
});
|
||||
};
|
||||
var compileUserDefinedGroups = function (groups) {
|
||||
return global$4.map(groups, function (group) {
|
||||
return global$4.extend({}, group, {
|
||||
original: group,
|
||||
selectors: {},
|
||||
filter: compileFilter(group.filter),
|
||||
item: {
|
||||
text: group.title,
|
||||
menu: []
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
var isExclusiveMode = function (editor, group) {
|
||||
return group === null || Settings.shouldImportExclusive(editor) !== false;
|
||||
};
|
||||
var isUniqueSelector = function (editor, selector, group, globallyUniqueSelectors) {
|
||||
return !(isExclusiveMode(editor, group) ? selector in globallyUniqueSelectors : selector in group.selectors);
|
||||
};
|
||||
var markUniqueSelector = function (editor, selector, group, globallyUniqueSelectors) {
|
||||
if (isExclusiveMode(editor, group)) {
|
||||
globallyUniqueSelectors[selector] = true;
|
||||
} else {
|
||||
group.selectors[selector] = true;
|
||||
}
|
||||
};
|
||||
var convertSelectorToFormat = function (editor, plugin, selector, group) {
|
||||
var selectorConverter;
|
||||
if (group && group.selector_converter) {
|
||||
selectorConverter = group.selector_converter;
|
||||
} else if (Settings.getSelectorConverter(editor)) {
|
||||
selectorConverter = Settings.getSelectorConverter(editor);
|
||||
} else {
|
||||
selectorConverter = function () {
|
||||
return defaultConvertSelectorToFormat(editor, selector);
|
||||
};
|
||||
}
|
||||
return selectorConverter.call(plugin, selector, group);
|
||||
};
|
||||
var setup = function (editor) {
|
||||
editor.on('init', function (e) {
|
||||
var model = generate();
|
||||
var globallyUniqueSelectors = {};
|
||||
var selectorFilter = compileFilter(Settings.getSelectorFilter(editor));
|
||||
var groups = compileUserDefinedGroups(Settings.getCssGroups(editor));
|
||||
var processSelector = function (selector, group) {
|
||||
if (isUniqueSelector(editor, selector, group, globallyUniqueSelectors)) {
|
||||
markUniqueSelector(editor, selector, group, globallyUniqueSelectors);
|
||||
var format = convertSelectorToFormat(editor, editor.plugins.importcss, selector, group);
|
||||
if (format) {
|
||||
var formatName = format.name || global$1.DOM.uniqueId();
|
||||
editor.formatter.register(formatName, format);
|
||||
return global$4.extend({}, {
|
||||
title: format.title,
|
||||
format: formatName
|
||||
});
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
global$4.each(getSelectors(editor, editor.getDoc(), compileFilter(Settings.getFileFilter(editor))), function (selector) {
|
||||
if (selector.indexOf('.mce-') === -1) {
|
||||
if (!selectorFilter || selectorFilter(selector)) {
|
||||
var selectorGroups = getGroupsBySelector(groups, selector);
|
||||
if (selectorGroups.length > 0) {
|
||||
global$4.each(selectorGroups, function (group) {
|
||||
var menuItem = processSelector(selector, group);
|
||||
if (menuItem) {
|
||||
model.addItemToGroup(group.title, menuItem);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var menuItem = processSelector(selector, null);
|
||||
if (menuItem) {
|
||||
model.addItem(menuItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
var items = model.toFormats();
|
||||
editor.fire('addStyleModifications', {
|
||||
items: items,
|
||||
replace: !Settings.shouldAppend(editor)
|
||||
});
|
||||
});
|
||||
};
|
||||
var ImportCss = {
|
||||
defaultConvertSelectorToFormat: defaultConvertSelectorToFormat,
|
||||
setup: setup
|
||||
};
|
||||
|
||||
var get = function (editor) {
|
||||
var convertSelectorToFormat = function (selectorText) {
|
||||
return ImportCss.defaultConvertSelectorToFormat(editor, selectorText);
|
||||
};
|
||||
return { convertSelectorToFormat: convertSelectorToFormat };
|
||||
};
|
||||
var Api = { get: get };
|
||||
|
||||
function Plugin () {
|
||||
global.add('importcss', function (editor) {
|
||||
ImportCss.setup(editor);
|
||||
return Api.get(editor);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";function t(){}function n(t){return function(){return t}}function e(){return h}var r,o=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),f=tinymce.util.Tools.resolve("tinymce.EditorManager"),l=tinymce.util.Tools.resolve("tinymce.Env"),m=tinymce.util.Tools.resolve("tinymce.util.Tools"),c=function(t){return t.getParam("importcss_merge_classes")},i=function(t){return t.getParam("importcss_exclusive")},p=function(t){return t.getParam("importcss_selector_converter")},g=function(t){return t.getParam("importcss_selector_filter")},y=function(t){return t.getParam("importcss_groups")},v=function(t){return t.getParam("importcss_append")},d=function(t){return t.getParam("importcss_file_filter")},u=n(!1),s=n(!0),h=(r={fold:function(t,n){return t()},is:u,isSome:u,isNone:s,getOr:O,getOrThunk:x,getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:n(null),getOrUndefined:n(undefined),or:O,orThunk:x,map:e,each:t,bind:e,exists:u,forall:s,filter:e,equals:_,equals_:_,toArray:function(){return[]},toString:n("none()")},Object.freeze&&Object.freeze(r),r);function _(t){return t.isNone()}function x(t){return t()}function O(t){return t}function T(n){return function(t){return function(t){if(null===t)return"null";var n=typeof t;return"object"==n&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"==n&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":n}(t)===n}}function b(t,n){return function(t){for(var n=[],e=0,r=t.length;e<r;++e){if(!w(t[e]))throw new Error("Arr.flatten item "+e+" was not an array, input: "+t);M.apply(n,t[e])}return n}(function(t,n){for(var e=t.length,r=new Array(e),o=0;o<e;o++){var i=t[o];r[o]=n(i,o)}return r}(t,n))}function k(n){return"string"==typeof n?function(t){return-1!==t.indexOf(n)}:n instanceof RegExp?function(t){return n.test(t)}:n}function S(i,t,u){var c=[],e={};function s(t,n){var e,r=t.href;if((r=function(t){var n=l.cacheSuffix;return"string"==typeof t&&(t=t.replace("?"+n,"").replace("&"+n,"")),t}(r))&&u(r,n)&&!function(t,n){var e=t.settings,r=!1!==e.skin&&(e.skin||"oxide");if(r){var o=e.skin_url?t.documentBaseURI.toAbsolute(e.skin_url):f.baseURL+"/skins/ui/"+r,i=f.baseURL+"/skins/content/";return n===o+"/content"+(t.inline?".inline":"")+".min.css"||-1!==n.indexOf(i)}return!1}(i,r)){m.each(t.imports,function(t){s(t,!0)});try{e=t.cssRules||t.rules}catch(o){}m.each(e,function(t){t.styleSheet?s(t.styleSheet,!0):t.selectorText&&m.each(t.selectorText.split(","),function(t){c.push(m.trim(t))})})}}m.each(i.contentCSS,function(t){e[t]=!0}),u=u||function(t,n){return n||e[t]};try{m.each(t.styleSheets,function(t){s(t)})}catch(n){}return c}function A(t,n){var e,r=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(n);if(r){var o=r[1],i=r[2].substr(1).split(".").join(" "),u=m.makeMap("a,img");return r[1]?(e={title:n},t.schema.getTextBlockElements()[o]?e.block=o:t.schema.getBlockElements()[o]||u[o.toLowerCase()]?e.selector=o:e.inline=o):r[2]&&(e={inline:"span",title:n.substr(1),classes:i}),!1!==c(t)?e.classes=i:e.attributes={"class":i},e}}function P(t,n){return null===n||!1!==i(t)}var w=T("array"),E=T("function"),I=Array.prototype.slice,M=Array.prototype.push,j=(E(Array.from)&&Array.from,A),D=function(s){s.on("init",function(t){function r(t,n){if(function(t,n,e,r){return!(P(t,e)?n in r:n in e.selectors)}(s,t,n,i)){!function(t,n,e,r){P(t,e)?r[n]=!0:e.selectors[n]=!0}(s,t,n,i);var e=function(t,n,e,r){return(r&&r.selector_converter?r.selector_converter:p(t)?p(t):function(){return A(t,e)}).call(n,e,r)}(s,s.plugins.importcss,t,n);if(e){var r=e.name||a.DOM.uniqueId();return s.formatter.register(r,e),m.extend({},{title:e.title,format:r})}}return null}var o=function(){var n=[],e=[],r={};return{addItemToGroup:function(t,n){r[t]?r[t].push(n):(e.push(t),r[t]=[n])},addItem:function(t){n.push(t)},toFormats:function(){return b(e,function(t){var n=r[t];return 0===n.length?[]:[{title:t,items:n}]}).concat(n)}}}(),i={},u=k(g(s)),c=function(t){return m.map(t,function(t){return m.extend({},t,{original:t,selectors:{},filter:k(t.filter),item:{text:t.title,menu:[]}})})}(y(s));m.each(S(s,s.getDoc(),k(d(s))),function(e){if(-1===e.indexOf(".mce-")&&(!u||u(e))){var t=function(t,n){return m.grep(t,function(t){return!t.filter||t.filter(n)})}(c,e);if(0<t.length)m.each(t,function(t){var n=r(e,t);n&&o.addItemToGroup(t.title,n)});else{var n=r(e,null);n&&o.addItem(n)}}});var n=o.toFormats();s.fire("addStyleModifications",{items:n,replace:!v(s)})})},R=function(n){return{convertSelectorToFormat:function(t){return j(n,t)}}};!function U(){o.add("importcss",function(t){return D(t),R(t)})}()}();
|
@ -0,0 +1,47 @@
|
||||
tinymce.PluginManager.add('indent2em', function(editor, url) {
|
||||
var pluginName='首行缩进';
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
var indent2em_val = editor.getParam('indent2em_val', '2em');
|
||||
var doAct = function () {
|
||||
var dom = editor.dom;
|
||||
var blocks = editor.selection.getSelectedBlocks();
|
||||
var act = '';
|
||||
global$1.each(blocks, function (block) {
|
||||
if(act==''){
|
||||
act = dom.getStyle(block,'text-indent')==indent2em_val ? 'remove' : 'add';
|
||||
}
|
||||
if( act=='add' ){
|
||||
dom.setStyle(block, 'text-indent', indent2em_val);
|
||||
}else{
|
||||
var style=dom.getAttrib(block,'style');
|
||||
style = style.replace(/text-indent:[\s]*2em;/ig,'');
|
||||
dom.setAttrib(block,'style',style);
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
editor.ui.registry.addButton('indent2em', {
|
||||
text: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M170.666667 563.2v-102.4H887.466667v102.4zM170.666667 836.266667v-102.4H887.466667v102.4zM512 290.133333v-102.4H887.466667v102.4zM238.933333 341.333333V136.533333l204.8 102.4z" fill="#2c2c2c" p-id="5210"></path></svg>',
|
||||
tooltip: pluginName,
|
||||
onAction: function () {
|
||||
doAct();
|
||||
}
|
||||
});
|
||||
|
||||
editor.ui.registry.addMenuItem('indent2em', {
|
||||
text: pluginName,
|
||||
onAction: function() {
|
||||
doAct();
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
getMetadata: function () {
|
||||
return {
|
||||
name: pluginName,
|
||||
url: "http://tinymce.ax-z.cn/more-plugins/indent2em.php",
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
@ -0,0 +1,47 @@
|
||||
tinymce.PluginManager.add('indent2em', function(editor, url) {
|
||||
var pluginName='首行缩进';
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
var indent2em_val = editor.getParam('indent2em_val', '2em');
|
||||
var doAct = function () {
|
||||
var dom = editor.dom;
|
||||
var blocks = editor.selection.getSelectedBlocks();
|
||||
var act = '';
|
||||
global$1.each(blocks, function (block) {
|
||||
if(act==''){
|
||||
act = dom.getStyle(block,'text-indent')==indent2em_val ? 'remove' : 'add';
|
||||
}
|
||||
if( act=='add' ){
|
||||
dom.setStyle(block, 'text-indent', indent2em_val);
|
||||
}else{
|
||||
var style=dom.getAttrib(block,'style');
|
||||
style = style.replace(/text-indent:[\s]*2em;/ig,'');
|
||||
dom.setAttrib(block,'style',style);
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
editor.ui.registry.addButton('indent2em', {
|
||||
text: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M170.666667 563.2v-102.4H887.466667v102.4zM170.666667 836.266667v-102.4H887.466667v102.4zM512 290.133333v-102.4H887.466667v102.4zM238.933333 341.333333V136.533333l204.8 102.4z" fill="#2c2c2c" p-id="5210"></path></svg>',
|
||||
tooltip: pluginName,
|
||||
onAction: function () {
|
||||
doAct();
|
||||
}
|
||||
});
|
||||
|
||||
editor.ui.registry.addMenuItem('indent2em', {
|
||||
text: pluginName,
|
||||
onAction: function() {
|
||||
doAct();
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
getMetadata: function () {
|
||||
return {
|
||||
name: pluginName,
|
||||
url: "http://tinymce.ax-z.cn/more-plugins/indent2em.php",
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
@ -0,0 +1,198 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var getDateFormat = function (editor) {
|
||||
return editor.getParam('insertdatetime_dateformat', editor.translate('%Y-%m-%d'));
|
||||
};
|
||||
var getTimeFormat = function (editor) {
|
||||
return editor.getParam('insertdatetime_timeformat', editor.translate('%H:%M:%S'));
|
||||
};
|
||||
var getFormats = function (editor) {
|
||||
return editor.getParam('insertdatetime_formats', [
|
||||
'%H:%M:%S',
|
||||
'%Y-%m-%d',
|
||||
'%I:%M:%S %p',
|
||||
'%D'
|
||||
]);
|
||||
};
|
||||
var getDefaultDateTime = function (editor) {
|
||||
var formats = getFormats(editor);
|
||||
return formats.length > 0 ? formats[0] : getTimeFormat(editor);
|
||||
};
|
||||
var shouldInsertTimeElement = function (editor) {
|
||||
return editor.getParam('insertdatetime_element', false);
|
||||
};
|
||||
var Settings = {
|
||||
getDateFormat: getDateFormat,
|
||||
getTimeFormat: getTimeFormat,
|
||||
getFormats: getFormats,
|
||||
getDefaultDateTime: getDefaultDateTime,
|
||||
shouldInsertTimeElement: shouldInsertTimeElement
|
||||
};
|
||||
|
||||
var daysShort = 'Sun Mon Tue Wed Thu Fri Sat Sun'.split(' ');
|
||||
var daysLong = 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday'.split(' ');
|
||||
var monthsShort = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
|
||||
var monthsLong = 'January February March April May June July August September October November December'.split(' ');
|
||||
var addZeros = function (value, len) {
|
||||
value = '' + value;
|
||||
if (value.length < len) {
|
||||
for (var i = 0; i < len - value.length; i++) {
|
||||
value = '0' + value;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
||||
var getDateTime = function (editor, fmt, date) {
|
||||
date = date || new Date();
|
||||
fmt = fmt.replace('%D', '%m/%d/%Y');
|
||||
fmt = fmt.replace('%r', '%I:%M:%S %p');
|
||||
fmt = fmt.replace('%Y', '' + date.getFullYear());
|
||||
fmt = fmt.replace('%y', '' + date.getYear());
|
||||
fmt = fmt.replace('%m', addZeros(date.getMonth() + 1, 2));
|
||||
fmt = fmt.replace('%d', addZeros(date.getDate(), 2));
|
||||
fmt = fmt.replace('%H', '' + addZeros(date.getHours(), 2));
|
||||
fmt = fmt.replace('%M', '' + addZeros(date.getMinutes(), 2));
|
||||
fmt = fmt.replace('%S', '' + addZeros(date.getSeconds(), 2));
|
||||
fmt = fmt.replace('%I', '' + ((date.getHours() + 11) % 12 + 1));
|
||||
fmt = fmt.replace('%p', '' + (date.getHours() < 12 ? 'AM' : 'PM'));
|
||||
fmt = fmt.replace('%B', '' + editor.translate(monthsLong[date.getMonth()]));
|
||||
fmt = fmt.replace('%b', '' + editor.translate(monthsShort[date.getMonth()]));
|
||||
fmt = fmt.replace('%A', '' + editor.translate(daysLong[date.getDay()]));
|
||||
fmt = fmt.replace('%a', '' + editor.translate(daysShort[date.getDay()]));
|
||||
fmt = fmt.replace('%%', '%');
|
||||
return fmt;
|
||||
};
|
||||
var updateElement = function (editor, timeElm, computerTime, userTime) {
|
||||
var newTimeElm = editor.dom.create('time', { datetime: computerTime }, userTime);
|
||||
timeElm.parentNode.insertBefore(newTimeElm, timeElm);
|
||||
editor.dom.remove(timeElm);
|
||||
editor.selection.select(newTimeElm, true);
|
||||
editor.selection.collapse(false);
|
||||
};
|
||||
var insertDateTime = function (editor, format) {
|
||||
if (Settings.shouldInsertTimeElement(editor)) {
|
||||
var userTime = getDateTime(editor, format);
|
||||
var computerTime = void 0;
|
||||
if (/%[HMSIp]/.test(format)) {
|
||||
computerTime = getDateTime(editor, '%Y-%m-%dT%H:%M');
|
||||
} else {
|
||||
computerTime = getDateTime(editor, '%Y-%m-%d');
|
||||
}
|
||||
var timeElm = editor.dom.getParent(editor.selection.getStart(), 'time');
|
||||
if (timeElm) {
|
||||
updateElement(editor, timeElm, computerTime, userTime);
|
||||
} else {
|
||||
editor.insertContent('<time datetime="' + computerTime + '">' + userTime + '</time>');
|
||||
}
|
||||
} else {
|
||||
editor.insertContent(getDateTime(editor, format));
|
||||
}
|
||||
};
|
||||
var Actions = {
|
||||
insertDateTime: insertDateTime,
|
||||
getDateTime: getDateTime
|
||||
};
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceInsertDate', function () {
|
||||
Actions.insertDateTime(editor, Settings.getDateFormat(editor));
|
||||
});
|
||||
editor.addCommand('mceInsertTime', function () {
|
||||
Actions.insertDateTime(editor, Settings.getTimeFormat(editor));
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var register$1 = function (editor) {
|
||||
var formats = Settings.getFormats(editor);
|
||||
var defaultFormat = Cell(Settings.getDefaultDateTime(editor));
|
||||
editor.ui.registry.addSplitButton('insertdatetime', {
|
||||
icon: 'insert-time',
|
||||
tooltip: 'Insert date/time',
|
||||
select: function (value) {
|
||||
return value === defaultFormat.get();
|
||||
},
|
||||
fetch: function (done) {
|
||||
done(global$1.map(formats, function (format) {
|
||||
return {
|
||||
type: 'choiceitem',
|
||||
text: Actions.getDateTime(editor, format),
|
||||
value: format
|
||||
};
|
||||
}));
|
||||
},
|
||||
onAction: function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
Actions.insertDateTime(editor, defaultFormat.get());
|
||||
},
|
||||
onItemAction: function (_, value) {
|
||||
defaultFormat.set(value);
|
||||
Actions.insertDateTime(editor, value);
|
||||
}
|
||||
});
|
||||
var makeMenuItemHandler = function (format) {
|
||||
return function () {
|
||||
defaultFormat.set(format);
|
||||
Actions.insertDateTime(editor, format);
|
||||
};
|
||||
};
|
||||
editor.ui.registry.addNestedMenuItem('insertdatetime', {
|
||||
icon: 'insert-time',
|
||||
text: 'Date/time',
|
||||
getSubmenuItems: function () {
|
||||
return global$1.map(formats, function (format) {
|
||||
return {
|
||||
type: 'menuitem',
|
||||
text: Actions.getDateTime(editor, format),
|
||||
onAction: makeMenuItemHandler(format)
|
||||
};
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
function Plugin () {
|
||||
global.add('insertdatetime', function (editor) {
|
||||
Commands.register(editor);
|
||||
Buttons.register(editor);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";function n(e){return e.getParam("insertdatetime_timeformat",e.translate("%H:%M:%S"))}function r(e){return e.getParam("insertdatetime_formats",["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"])}function a(e,t){if((e=""+e).length<t)for(var n=0;n<t-e.length;n++)e="0"+e;return e}function i(e,t,n){return n=n||new Date,t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%D","%m/%d/%Y")).replace("%r","%I:%M:%S %p")).replace("%Y",""+n.getFullYear())).replace("%y",""+n.getYear())).replace("%m",a(n.getMonth()+1,2))).replace("%d",a(n.getDate(),2))).replace("%H",""+a(n.getHours(),2))).replace("%M",""+a(n.getMinutes(),2))).replace("%S",""+a(n.getSeconds(),2))).replace("%I",""+((n.getHours()+11)%12+1))).replace("%p",n.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(f[n.getMonth()]))).replace("%b",""+e.translate(d[n.getMonth()]))).replace("%A",""+e.translate(s[n.getDay()]))).replace("%a",""+e.translate(l[n.getDay()]))).replace("%%","%")}var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(e){return e.getParam("insertdatetime_dateformat",e.translate("%Y-%m-%d"))},o=n,u=r,c=function(e){var t=r(e);return 0<t.length?t[0]:n(e)},m=function(e){return e.getParam("insertdatetime_element",!1)},l="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),s="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),d="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),f="January February March April May June July August September October November December".split(" "),p=function(e,t){if(m(e)){var n=i(e,t),r=void 0;r=/%[HMSIp]/.test(t)?i(e,"%Y-%m-%dT%H:%M"):i(e,"%Y-%m-%d");var a=e.dom.getParent(e.selection.getStart(),"time");a?function(e,t,n,r){var a=e.dom.create("time",{datetime:n},r);t.parentNode.insertBefore(a,t),e.dom.remove(t),e.selection.select(a,!0),e.selection.collapse(!1)}(e,a,r,n):e.insertContent('<time datetime="'+r+'">'+n+"</time>")}else e.insertContent(i(e,t))},g=i,y=function(e){e.addCommand("mceInsertDate",function(){p(e,t(e))}),e.addCommand("mceInsertTime",function(){p(e,o(e))})},M=tinymce.util.Tools.resolve("tinymce.util.Tools"),S=function(e){function t(){return n}var n=e;return{get:t,set:function(e){n=e},clone:function(){return S(t())}}},v=function(n){var t=u(n),r=S(c(n));n.ui.registry.addSplitButton("insertdatetime",{icon:"insert-time",tooltip:"Insert date/time",select:function(e){return e===r.get()},fetch:function(e){e(M.map(t,function(e){return{type:"choiceitem",text:g(n,e),value:e}}))},onAction:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];p(n,r.get())},onItemAction:function(e,t){r.set(t),p(n,t)}});n.ui.registry.addNestedMenuItem("insertdatetime",{icon:"insert-time",text:"Date/time",getSubmenuItems:function(){return M.map(t,function(e){return{type:"menuitem",text:g(n,e),onAction:function(e){return function(){r.set(e),p(n,e)}}(e)}})}})};!function h(){e.add("insertdatetime",function(e){y(e),v(e)})}()}();
|
@ -0,0 +1,184 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var getFontSizeFormats = function (editor) {
|
||||
return editor.getParam('fontsize_formats');
|
||||
};
|
||||
var setFontSizeFormats = function (editor, fontsize_formats) {
|
||||
editor.settings.fontsize_formats = fontsize_formats;
|
||||
};
|
||||
var getFontFormats = function (editor) {
|
||||
return editor.getParam('font_formats');
|
||||
};
|
||||
var setFontFormats = function (editor, font_formats) {
|
||||
editor.settings.font_formats = font_formats;
|
||||
};
|
||||
var getFontSizeStyleValues = function (editor) {
|
||||
return editor.getParam('font_size_style_values', 'xx-small,x-small,small,medium,large,x-large,xx-large');
|
||||
};
|
||||
var setInlineStyles = function (editor, inline_styles) {
|
||||
editor.settings.inline_styles = inline_styles;
|
||||
};
|
||||
var Settings = {
|
||||
getFontFormats: getFontFormats,
|
||||
getFontSizeFormats: getFontSizeFormats,
|
||||
setFontSizeFormats: setFontSizeFormats,
|
||||
setFontFormats: setFontFormats,
|
||||
getFontSizeStyleValues: getFontSizeStyleValues,
|
||||
setInlineStyles: setInlineStyles
|
||||
};
|
||||
|
||||
var overrideFormats = function (editor) {
|
||||
var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table', fontSizes = global$1.explode(Settings.getFontSizeStyleValues(editor)), schema = editor.schema;
|
||||
editor.formatter.register({
|
||||
alignleft: {
|
||||
selector: alignElements,
|
||||
attributes: { align: 'left' }
|
||||
},
|
||||
aligncenter: {
|
||||
selector: alignElements,
|
||||
attributes: { align: 'center' }
|
||||
},
|
||||
alignright: {
|
||||
selector: alignElements,
|
||||
attributes: { align: 'right' }
|
||||
},
|
||||
alignjustify: {
|
||||
selector: alignElements,
|
||||
attributes: { align: 'justify' }
|
||||
},
|
||||
bold: [
|
||||
{
|
||||
inline: 'b',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'strong',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'span',
|
||||
styles: { fontWeight: 'bold' }
|
||||
}
|
||||
],
|
||||
italic: [
|
||||
{
|
||||
inline: 'i',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'em',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'span',
|
||||
styles: { fontStyle: 'italic' }
|
||||
}
|
||||
],
|
||||
underline: [
|
||||
{
|
||||
inline: 'u',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'span',
|
||||
styles: { textDecoration: 'underline' },
|
||||
exact: true
|
||||
}
|
||||
],
|
||||
strikethrough: [
|
||||
{
|
||||
inline: 'strike',
|
||||
remove: 'all'
|
||||
},
|
||||
{
|
||||
inline: 'span',
|
||||
styles: { textDecoration: 'line-through' },
|
||||
exact: true
|
||||
}
|
||||
],
|
||||
fontname: {
|
||||
inline: 'font',
|
||||
toggle: false,
|
||||
attributes: { face: '%value' }
|
||||
},
|
||||
fontsize: {
|
||||
inline: 'font',
|
||||
toggle: false,
|
||||
attributes: {
|
||||
size: function (vars) {
|
||||
return String(global$1.inArray(fontSizes, vars.value) + 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
forecolor: {
|
||||
inline: 'font',
|
||||
attributes: { color: '%value' },
|
||||
links: true,
|
||||
remove_similar: true,
|
||||
clear_child_styles: true
|
||||
},
|
||||
hilitecolor: {
|
||||
inline: 'font',
|
||||
styles: { backgroundColor: '%value' },
|
||||
links: true,
|
||||
remove_similar: true,
|
||||
clear_child_styles: true
|
||||
}
|
||||
});
|
||||
global$1.each('b,i,u,strike'.split(','), function (name) {
|
||||
schema.addValidElements(name + '[*]');
|
||||
});
|
||||
if (!schema.getElementRule('font')) {
|
||||
schema.addValidElements('font[face|size|color|style]');
|
||||
}
|
||||
global$1.each(alignElements.split(','), function (name) {
|
||||
var rule = schema.getElementRule(name);
|
||||
if (rule) {
|
||||
if (!rule.attributes.align) {
|
||||
rule.attributes.align = {};
|
||||
rule.attributesOrder.push('align');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
var overrideSettings = function (editor) {
|
||||
var defaultFontsizeFormats = '8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7';
|
||||
var defaultFontsFormats = 'Andale Mono=andale mono,monospace;' + 'Arial=arial,helvetica,sans-serif;' + 'Arial Black=arial black,sans-serif;' + 'Book Antiqua=book antiqua,palatino,serif;' + 'Comic Sans MS=comic sans ms,sans-serif;' + 'Courier New=courier new,courier,monospace;' + 'Georgia=georgia,palatino,serif;' + 'Helvetica=helvetica,arial,sans-serif;' + 'Impact=impact,sans-serif;' + 'Symbol=symbol;' + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + 'Terminal=terminal,monaco,monospace;' + 'Times New Roman=times new roman,times,serif;' + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + 'Verdana=verdana,geneva,sans-serif;' + 'Webdings=webdings;' + 'Wingdings=wingdings,zapf dingbats';
|
||||
Settings.setInlineStyles(editor, false);
|
||||
if (!Settings.getFontSizeFormats(editor)) {
|
||||
Settings.setFontSizeFormats(editor, defaultFontsizeFormats);
|
||||
}
|
||||
if (!Settings.getFontFormats(editor)) {
|
||||
Settings.setFontFormats(editor, defaultFontsFormats);
|
||||
}
|
||||
};
|
||||
var setup = function (editor) {
|
||||
overrideSettings(editor);
|
||||
editor.on('PreInit', function () {
|
||||
return overrideFormats(editor);
|
||||
});
|
||||
};
|
||||
var Formats = { setup: setup };
|
||||
|
||||
function Plugin () {
|
||||
global.add('legacyoutput', function (editor) {
|
||||
Formats.setup(editor);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.util.Tools"),t=function(e){return e.getParam("font_formats")},i=function(e){return e.getParam("fontsize_formats")},n=function(e,t){e.settings.fontsize_formats=t},l=function(e,t){e.settings.font_formats=t},s=function(e){return e.getParam("font_size_style_values","xx-small,x-small,small,medium,large,x-large,xx-large")},r=function(e,t){e.settings.inline_styles=t},o=function(e){!function(e){r(e,!1),i(e)||n(e,"8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7"),t(e)||l(e,"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats")}(e),e.on("PreInit",function(){return function(e){var t="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table",i=a.explode(s(e)),n=e.schema;e.formatter.register({alignleft:{selector:t,attributes:{align:"left"}},aligncenter:{selector:t,attributes:{align:"center"}},alignright:{selector:t,attributes:{align:"right"}},alignjustify:{selector:t,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:!0}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:!0}],fontname:{inline:"font",toggle:!1,attributes:{face:"%value"}},fontsize:{inline:"font",toggle:!1,attributes:{size:function(e){return String(a.inArray(i,e.value)+1)}}},forecolor:{inline:"font",attributes:{color:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0}}),a.each("b,i,u,strike".split(","),function(e){n.addValidElements(e+"[*]")}),n.getElementRule("font")||n.addValidElements("font[face|size|color|style]"),a.each(t.split(","),function(e){var t=n.getElementRule(e);t&&(t.attributes.align||(t.attributes.align={},t.attributesOrder.push("align")))})}(e)})};!function c(){e.add("legacyoutput",function(e){o(e)})}()}();
|
@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var getKeyboardSpaces = function (editor) {
|
||||
var spaces = editor.getParam('nonbreaking_force_tab', 0);
|
||||
if (typeof spaces === 'boolean') {
|
||||
return spaces === true ? 3 : 0;
|
||||
} else {
|
||||
return spaces;
|
||||
}
|
||||
};
|
||||
var wrapNbsps = function (editor) {
|
||||
return editor.getParam('nonbreaking_wrap', true, 'boolean');
|
||||
};
|
||||
var Settings = {
|
||||
getKeyboardSpaces: getKeyboardSpaces,
|
||||
wrapNbsps: wrapNbsps
|
||||
};
|
||||
|
||||
var stringRepeat = function (string, repeats) {
|
||||
var str = '';
|
||||
for (var index = 0; index < repeats; index++) {
|
||||
str += string;
|
||||
}
|
||||
return str;
|
||||
};
|
||||
var isVisualCharsEnabled = function (editor) {
|
||||
return editor.plugins.visualchars ? editor.plugins.visualchars.isEnabled() : false;
|
||||
};
|
||||
var insertNbsp = function (editor, times) {
|
||||
var classes = function () {
|
||||
return isVisualCharsEnabled(editor) ? 'mce-nbsp-wrap mce-nbsp' : 'mce-nbsp-wrap';
|
||||
};
|
||||
var nbspSpan = function () {
|
||||
return '<span class="' + classes() + '" contenteditable="false">' + stringRepeat(' ', times) + '</span>';
|
||||
};
|
||||
var shouldWrap = Settings.wrapNbsps(editor);
|
||||
var html = shouldWrap || editor.plugins.visualchars ? nbspSpan() : stringRepeat(' ', times);
|
||||
editor.undoManager.transact(function () {
|
||||
return editor.insertContent(html);
|
||||
});
|
||||
};
|
||||
var Actions = { insertNbsp: insertNbsp };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceNonBreaking', function () {
|
||||
Actions.insertNbsp(editor, 1);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
||||
|
||||
var setup = function (editor) {
|
||||
var spaces = Settings.getKeyboardSpaces(editor);
|
||||
if (spaces > 0) {
|
||||
editor.on('keydown', function (e) {
|
||||
if (e.keyCode === global$1.TAB && !e.isDefaultPrevented()) {
|
||||
if (e.shiftKey) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
Actions.insertNbsp(editor, spaces);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
var Keyboard = { setup: setup };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.ui.registry.addButton('nonbreaking', {
|
||||
icon: 'non-breaking',
|
||||
tooltip: 'Nonbreaking space',
|
||||
onAction: function () {
|
||||
return editor.execCommand('mceNonBreaking');
|
||||
}
|
||||
});
|
||||
editor.ui.registry.addMenuItem('nonbreaking', {
|
||||
icon: 'non-breaking',
|
||||
text: 'Nonbreaking space',
|
||||
onAction: function () {
|
||||
return editor.execCommand('mceNonBreaking');
|
||||
}
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
function Plugin () {
|
||||
global.add('nonbreaking', function (editor) {
|
||||
Commands.register(editor);
|
||||
Buttons.register(editor);
|
||||
Keyboard.setup(editor);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";function o(n,e){for(var t="",o=0;o<e;o++)t+=n;return t}var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(n){var e=n.getParam("nonbreaking_force_tab",0);return"boolean"==typeof e?!0===e?3:0:e},a=function(n){return n.getParam("nonbreaking_wrap",!0,"boolean")},r=function(n,e){var t=a(n)||n.plugins.visualchars?'<span class="'+(function(n){return!!n.plugins.visualchars&&n.plugins.visualchars.isEnabled()}(n)?"mce-nbsp-wrap mce-nbsp":"mce-nbsp-wrap")+'" contenteditable="false">'+o(" ",e)+"</span>":o(" ",e);n.undoManager.transact(function(){return n.insertContent(t)})},e=function(n){n.addCommand("mceNonBreaking",function(){r(n,1)})},c=tinymce.util.Tools.resolve("tinymce.util.VK"),t=function(e){var t=i(e);0<t&&e.on("keydown",function(n){if(n.keyCode===c.TAB&&!n.isDefaultPrevented()){if(n.shiftKey)return;n.preventDefault(),n.stopImmediatePropagation(),r(e,t)}})},u=function(n){n.ui.registry.addButton("nonbreaking",{icon:"non-breaking",tooltip:"Nonbreaking space",onAction:function(){return n.execCommand("mceNonBreaking")}}),n.ui.registry.addMenuItem("nonbreaking",{icon:"non-breaking",text:"Nonbreaking space",onAction:function(){return n.execCommand("mceNonBreaking")}})};!function s(){n.add("nonbreaking",function(n){e(n),u(n),t(n)})}()}();
|
@ -0,0 +1,124 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var getNonEditableClass = function (editor) {
|
||||
return editor.getParam('noneditable_noneditable_class', 'mceNonEditable');
|
||||
};
|
||||
var getEditableClass = function (editor) {
|
||||
return editor.getParam('noneditable_editable_class', 'mceEditable');
|
||||
};
|
||||
var getNonEditableRegExps = function (editor) {
|
||||
var nonEditableRegExps = editor.getParam('noneditable_regexp', []);
|
||||
if (nonEditableRegExps && nonEditableRegExps.constructor === RegExp) {
|
||||
return [nonEditableRegExps];
|
||||
} else {
|
||||
return nonEditableRegExps;
|
||||
}
|
||||
};
|
||||
var Settings = {
|
||||
getNonEditableClass: getNonEditableClass,
|
||||
getEditableClass: getEditableClass,
|
||||
getNonEditableRegExps: getNonEditableRegExps
|
||||
};
|
||||
|
||||
var hasClass = function (checkClassName) {
|
||||
return function (node) {
|
||||
return (' ' + node.attr('class') + ' ').indexOf(checkClassName) !== -1;
|
||||
};
|
||||
};
|
||||
var replaceMatchWithSpan = function (editor, content, cls) {
|
||||
return function (match) {
|
||||
var args = arguments, index = args[args.length - 2];
|
||||
var prevChar = index > 0 ? content.charAt(index - 1) : '';
|
||||
if (prevChar === '"') {
|
||||
return match;
|
||||
}
|
||||
if (prevChar === '>') {
|
||||
var findStartTagIndex = content.lastIndexOf('<', index);
|
||||
if (findStartTagIndex !== -1) {
|
||||
var tagHtml = content.substring(findStartTagIndex, index);
|
||||
if (tagHtml.indexOf('contenteditable="false"') !== -1) {
|
||||
return match;
|
||||
}
|
||||
}
|
||||
}
|
||||
return '<span class="' + cls + '" data-mce-content="' + editor.dom.encode(args[0]) + '">' + editor.dom.encode(typeof args[1] === 'string' ? args[1] : args[0]) + '</span>';
|
||||
};
|
||||
};
|
||||
var convertRegExpsToNonEditable = function (editor, nonEditableRegExps, e) {
|
||||
var i = nonEditableRegExps.length, content = e.content;
|
||||
if (e.format === 'raw') {
|
||||
return;
|
||||
}
|
||||
while (i--) {
|
||||
content = content.replace(nonEditableRegExps[i], replaceMatchWithSpan(editor, content, Settings.getNonEditableClass(editor)));
|
||||
}
|
||||
e.content = content;
|
||||
};
|
||||
var setup = function (editor) {
|
||||
var editClass, nonEditClass;
|
||||
var contentEditableAttrName = 'contenteditable';
|
||||
editClass = ' ' + global$1.trim(Settings.getEditableClass(editor)) + ' ';
|
||||
nonEditClass = ' ' + global$1.trim(Settings.getNonEditableClass(editor)) + ' ';
|
||||
var hasEditClass = hasClass(editClass);
|
||||
var hasNonEditClass = hasClass(nonEditClass);
|
||||
var nonEditableRegExps = Settings.getNonEditableRegExps(editor);
|
||||
editor.on('PreInit', function () {
|
||||
if (nonEditableRegExps.length > 0) {
|
||||
editor.on('BeforeSetContent', function (e) {
|
||||
convertRegExpsToNonEditable(editor, nonEditableRegExps, e);
|
||||
});
|
||||
}
|
||||
editor.parser.addAttributeFilter('class', function (nodes) {
|
||||
var i = nodes.length, node;
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
if (hasEditClass(node)) {
|
||||
node.attr(contentEditableAttrName, 'true');
|
||||
} else if (hasNonEditClass(node)) {
|
||||
node.attr(contentEditableAttrName, 'false');
|
||||
}
|
||||
}
|
||||
});
|
||||
editor.serializer.addAttributeFilter(contentEditableAttrName, function (nodes) {
|
||||
var i = nodes.length, node;
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
if (!hasEditClass(node) && !hasNonEditClass(node)) {
|
||||
continue;
|
||||
}
|
||||
if (nonEditableRegExps.length > 0 && node.attr('data-mce-content')) {
|
||||
node.name = '#text';
|
||||
node.type = 3;
|
||||
node.raw = true;
|
||||
node.value = node.attr('data-mce-content');
|
||||
} else {
|
||||
node.attr(contentEditableAttrName, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
var FilterContent = { setup: setup };
|
||||
|
||||
function Plugin () {
|
||||
global.add('noneditable', function (editor) {
|
||||
FilterContent.setup(editor);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";function c(n){return function(t){return-1!==(" "+t.attr("class")+" ").indexOf(n)}}function l(i,o,c){return function(t){var n=arguments,e=n[n.length-2],r=0<e?o.charAt(e-1):"";if('"'===r)return t;if(">"===r){var a=o.lastIndexOf("<",e);if(-1!==a)if(-1!==o.substring(a,e).indexOf('contenteditable="false"'))return t}return'<span class="'+c+'" data-mce-content="'+i.dom.encode(n[0])+'">'+i.dom.encode("string"==typeof n[1]?n[1]:n[0])+"</span>"}}var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=tinymce.util.Tools.resolve("tinymce.util.Tools"),f=function(t){return t.getParam("noneditable_noneditable_class","mceNonEditable")},s=function(t){return t.getParam("noneditable_editable_class","mceEditable")},d=function(t){var n=t.getParam("noneditable_regexp",[]);return n&&n.constructor===RegExp?[n]:n},n=function(n){var t,e,r="contenteditable";t=" "+u.trim(s(n))+" ",e=" "+u.trim(f(n))+" ";var a=c(t),i=c(e),o=d(n);n.on("PreInit",function(){0<o.length&&n.on("BeforeSetContent",function(t){!function(t,n,e){var r=n.length,a=e.content;if("raw"!==e.format){for(;r--;)a=a.replace(n[r],l(t,a,f(t)));e.content=a}}(n,o,t)}),n.parser.addAttributeFilter("class",function(t){for(var n,e=t.length;e--;)n=t[e],a(n)?n.attr(r,"true"):i(n)&&n.attr(r,"false")}),n.serializer.addAttributeFilter(r,function(t){for(var n,e=t.length;e--;)n=t[e],(a(n)||i(n))&&(0<o.length&&n.attr("data-mce-content")?(n.name="#text",n.type=3,n.raw=!0,n.value=n.attr("data-mce-content")):n.attr(r,null))})})};!function e(){t.add("noneditable",function(t){n(t)})}()}();
|
@ -0,0 +1,119 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var getSeparatorHtml = function (editor) {
|
||||
return editor.getParam('pagebreak_separator', '<!-- pagebreak -->');
|
||||
};
|
||||
var shouldSplitBlock = function (editor) {
|
||||
return editor.getParam('pagebreak_split_block', false);
|
||||
};
|
||||
var Settings = {
|
||||
getSeparatorHtml: getSeparatorHtml,
|
||||
shouldSplitBlock: shouldSplitBlock
|
||||
};
|
||||
|
||||
var getPageBreakClass = function () {
|
||||
return 'mce-pagebreak';
|
||||
};
|
||||
var getPlaceholderHtml = function () {
|
||||
return '<img src="' + global$1.transparentSrc + '" class="' + getPageBreakClass() + '" data-mce-resize="false" data-mce-placeholder />';
|
||||
};
|
||||
var setup = function (editor) {
|
||||
var separatorHtml = Settings.getSeparatorHtml(editor);
|
||||
var pageBreakSeparatorRegExp = new RegExp(separatorHtml.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function (a) {
|
||||
return '\\' + a;
|
||||
}), 'gi');
|
||||
editor.on('BeforeSetContent', function (e) {
|
||||
e.content = e.content.replace(pageBreakSeparatorRegExp, getPlaceholderHtml());
|
||||
});
|
||||
editor.on('PreInit', function () {
|
||||
editor.serializer.addNodeFilter('img', function (nodes) {
|
||||
var i = nodes.length, node, className;
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
className = node.attr('class');
|
||||
if (className && className.indexOf('mce-pagebreak') !== -1) {
|
||||
var parentNode = node.parent;
|
||||
if (editor.schema.getBlockElements()[parentNode.name] && Settings.shouldSplitBlock(editor)) {
|
||||
parentNode.type = 3;
|
||||
parentNode.value = separatorHtml;
|
||||
parentNode.raw = true;
|
||||
node.remove();
|
||||
continue;
|
||||
}
|
||||
node.type = 3;
|
||||
node.value = separatorHtml;
|
||||
node.raw = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
var FilterContent = {
|
||||
setup: setup,
|
||||
getPlaceholderHtml: getPlaceholderHtml,
|
||||
getPageBreakClass: getPageBreakClass
|
||||
};
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mcePageBreak', function () {
|
||||
if (editor.settings.pagebreak_split_block) {
|
||||
editor.insertContent('<p>' + FilterContent.getPlaceholderHtml() + '</p>');
|
||||
} else {
|
||||
editor.insertContent(FilterContent.getPlaceholderHtml());
|
||||
}
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var setup$1 = function (editor) {
|
||||
editor.on('ResolveName', function (e) {
|
||||
if (e.target.nodeName === 'IMG' && editor.dom.hasClass(e.target, FilterContent.getPageBreakClass())) {
|
||||
e.name = 'pagebreak';
|
||||
}
|
||||
});
|
||||
};
|
||||
var ResolveName = { setup: setup$1 };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.ui.registry.addButton('pagebreak', {
|
||||
icon: 'page-break',
|
||||
tooltip: 'Page break',
|
||||
onAction: function () {
|
||||
return editor.execCommand('mcePageBreak');
|
||||
}
|
||||
});
|
||||
editor.ui.registry.addMenuItem('pagebreak', {
|
||||
text: 'Page break',
|
||||
icon: 'page-break',
|
||||
onAction: function () {
|
||||
return editor.execCommand('mcePageBreak');
|
||||
}
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
function Plugin () {
|
||||
global.add('pagebreak', function (editor) {
|
||||
Commands.register(editor);
|
||||
Buttons.register(editor);
|
||||
FilterContent.setup(editor);
|
||||
ResolveName.setup(editor);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";function e(){return"mce-pagebreak"}function a(){return'<img src="'+t.transparentSrc+'" class="mce-pagebreak" data-mce-resize="false" data-mce-placeholder />'}var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env"),r=function(e){return e.getParam("pagebreak_separator","\x3c!-- pagebreak --\x3e")},i=function(e){return e.getParam("pagebreak_split_block",!1)},o=function(o){var c=r(o),n=new RegExp(c.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(e){return"\\"+e}),"gi");o.on("BeforeSetContent",function(e){e.content=e.content.replace(n,a())}),o.on("PreInit",function(){o.serializer.addNodeFilter("img",function(e){for(var n,a,t=e.length;t--;)if((a=(n=e[t]).attr("class"))&&-1!==a.indexOf("mce-pagebreak")){var r=n.parent;if(o.schema.getBlockElements()[r.name]&&i(o)){r.type=3,r.value=c,r.raw=!0,n.remove();continue}n.type=3,n.value=c,n.raw=!0}})})},c=a,u=e,g=function(e){e.addCommand("mcePageBreak",function(){e.settings.pagebreak_split_block?e.insertContent("<p>"+c()+"</p>"):e.insertContent(c())})},m=function(n){n.on("ResolveName",function(e){"IMG"===e.target.nodeName&&n.dom.hasClass(e.target,u())&&(e.name="pagebreak")})},s=function(e){e.ui.registry.addButton("pagebreak",{icon:"page-break",tooltip:"Page break",onAction:function(){return e.execCommand("mcePageBreak")}}),e.ui.registry.addMenuItem("pagebreak",{text:"Page break",icon:"page-break",onAction:function(){return e.execCommand("mcePageBreak")}})};!function l(){n.add("pagebreak",function(e){g(e),s(e),o(e),m(e)})}()}();
|
@ -0,0 +1,126 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var getPreviewDialogWidth = function (editor) {
|
||||
return parseInt(editor.getParam('plugin_preview_width', '650'), 10);
|
||||
};
|
||||
var getPreviewDialogHeight = function (editor) {
|
||||
return parseInt(editor.getParam('plugin_preview_height', '500'), 10);
|
||||
};
|
||||
var getContentStyle = function (editor) {
|
||||
return editor.getParam('content_style', '');
|
||||
};
|
||||
var shouldUseContentCssCors = function (editor) {
|
||||
return editor.getParam('content_css_cors', false, 'boolean');
|
||||
};
|
||||
var Settings = {
|
||||
getPreviewDialogWidth: getPreviewDialogWidth,
|
||||
getPreviewDialogHeight: getPreviewDialogHeight,
|
||||
getContentStyle: getContentStyle,
|
||||
shouldUseContentCssCors: shouldUseContentCssCors
|
||||
};
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var getPreviewHtml = function (editor) {
|
||||
var headHtml = '';
|
||||
var encode = editor.dom.encode;
|
||||
var contentStyle = Settings.getContentStyle(editor);
|
||||
headHtml += '<base href="' + encode(editor.documentBaseURI.getURI()) + '">';
|
||||
if (contentStyle) {
|
||||
headHtml += '<style type="text/css">' + contentStyle + '</style>';
|
||||
}
|
||||
var cors = Settings.shouldUseContentCssCors(editor) ? ' crossorigin="anonymous"' : '';
|
||||
global$1.each(editor.contentCSS, function (url) {
|
||||
headHtml += '<link type="text/css" rel="stylesheet" href="' + encode(editor.documentBaseURI.toAbsolute(url)) + '"' + cors + '>';
|
||||
});
|
||||
var bodyId = editor.settings.body_id || 'tinymce';
|
||||
if (bodyId.indexOf('=') !== -1) {
|
||||
bodyId = editor.getParam('body_id', '', 'hash');
|
||||
bodyId = bodyId[editor.id] || bodyId;
|
||||
}
|
||||
var bodyClass = editor.settings.body_class || '';
|
||||
if (bodyClass.indexOf('=') !== -1) {
|
||||
bodyClass = editor.getParam('body_class', '', 'hash');
|
||||
bodyClass = bodyClass[editor.id] || '';
|
||||
}
|
||||
var isMetaKeyPressed = global$2.mac ? 'e.metaKey' : 'e.ctrlKey && !e.altKey';
|
||||
var preventClicksOnLinksScript = '<script>' + 'document.addEventListener && document.addEventListener("click", function(e) {' + 'for (var elm = e.target; elm; elm = elm.parentNode) {' + 'if (elm.nodeName === "A" && !(' + isMetaKeyPressed + ')) {' + 'e.preventDefault();' + '}' + '}' + '}, false);' + '</script> ';
|
||||
var directionality = editor.getBody().dir;
|
||||
var dirAttr = directionality ? ' dir="' + encode(directionality) + '"' : '';
|
||||
var previewHtml = '<!DOCTYPE html>' + '<html>' + '<head>' + headHtml + '</head>' + '<body id="' + encode(bodyId) + '" class="mce-content-body ' + encode(bodyClass) + '"' + dirAttr + '>' + editor.getContent() + preventClicksOnLinksScript + '</body>' + '</html>';
|
||||
return previewHtml;
|
||||
};
|
||||
var IframeContent = { getPreviewHtml: getPreviewHtml };
|
||||
|
||||
var open = function (editor) {
|
||||
var content = IframeContent.getPreviewHtml(editor);
|
||||
var dataApi = editor.windowManager.open({
|
||||
title: 'Preview',
|
||||
size: 'large',
|
||||
body: {
|
||||
type: 'panel',
|
||||
items: [{
|
||||
name: 'preview',
|
||||
type: 'iframe',
|
||||
sandboxed: true
|
||||
}]
|
||||
},
|
||||
buttons: [{
|
||||
type: 'cancel',
|
||||
name: 'close',
|
||||
text: 'Close',
|
||||
primary: true
|
||||
}],
|
||||
initialData: { preview: content }
|
||||
});
|
||||
dataApi.focus('close');
|
||||
};
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mcePreview', function () {
|
||||
open(editor);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.ui.registry.addButton('preview', {
|
||||
icon: 'preview',
|
||||
tooltip: 'Preview',
|
||||
onAction: function () {
|
||||
return editor.execCommand('mcePreview');
|
||||
}
|
||||
});
|
||||
editor.ui.registry.addMenuItem('preview', {
|
||||
icon: 'preview',
|
||||
text: 'Preview',
|
||||
onAction: function () {
|
||||
return editor.execCommand('mcePreview');
|
||||
}
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
function Plugin () {
|
||||
global.add('preview', function (editor) {
|
||||
Commands.register(editor);
|
||||
Buttons.register(editor);
|
||||
});
|
||||
}
|
||||
|
||||
Plugin();
|
||||
|
||||
}());
|
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
||||
* Licensed under the LGPL or a commercial license.
|
||||
* For LGPL see License.txt in the project root for license information.
|
||||
* For commercial licenses see https://www.tiny.cloud/
|
||||
*
|
||||
* Version: 5.2.0 (2020-02-13)
|
||||
*/
|
||||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),l=tinymce.util.Tools.resolve("tinymce.util.Tools"),m=function(e){return e.getParam("content_style","")},u=function(e){return e.getParam("content_css_cors",!1,"boolean")},y=tinymce.util.Tools.resolve("tinymce.Env"),n=function(t){var n="",i=t.dom.encode,e=m(t);n+='<base href="'+i(t.documentBaseURI.getURI())+'">',e&&(n+='<style type="text/css">'+e+"</style>");var o=u(t)?' crossorigin="anonymous"':"";l.each(t.contentCSS,function(e){n+='<link type="text/css" rel="stylesheet" href="'+i(t.documentBaseURI.toAbsolute(e))+'"'+o+">"});var r=t.settings.body_id||"tinymce";-1!==r.indexOf("=")&&(r=(r=t.getParam("body_id","","hash"))[t.id]||r);var a=t.settings.body_class||"";-1!==a.indexOf("=")&&(a=(a=t.getParam("body_class","","hash"))[t.id]||"");var c='<script>document.addEventListener && document.addEventListener("click", function(e) {for (var elm = e.target; elm; elm = elm.parentNode) {if (elm.nodeName === "A" && !('+(y.mac?"e.metaKey":"e.ctrlKey && !e.altKey")+")) {e.preventDefault();}}}, false);<\/script> ",s=t.getBody().dir,d=s?' dir="'+i(s)+'"':"";return"<!DOCTYPE html><html><head>"+n+'</head><body id="'+i(r)+'" class="mce-content-body '+i(a)+'"'+d+">"+t.getContent()+c+"</body></html>"},t=function(e){e.addCommand("mcePreview",function(){!function(e){var t=n(e);e.windowManager.open({title:"Preview",size:"large",body:{type:"panel",items:[{name:"preview",type:"iframe",sandboxed:!0}]},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}],initialData:{preview:t}}).focus("close")}(e)})},i=function(e){e.ui.registry.addButton("preview",{icon:"preview",tooltip:"Preview",onAction:function(){return e.execCommand("mcePreview")}}),e.ui.registry.addMenuItem("preview",{icon:"preview",text:"Preview",onAction:function(){return e.execCommand("mcePreview")}})};!function o(){e.add("preview",function(e){t(e),i(e)})}()}();
|