Remove TinyMce Added Squire

This commit is contained in:
Max G 2020-02-01 22:21:22 +00:00
parent f99d6ed430
commit 2828cc9462
91 changed files with 6538 additions and 10672 deletions

View File

@ -8,6 +8,7 @@
<link rel="shortcut icon" href="/api/static/assets/favicon.ico" type="image/x-icon"/> <link rel="shortcut icon" href="/api/static/assets/favicon.ico" type="image/x-icon"/>
<meta name="theme-color" content="#000" /> <meta name="theme-color" content="#000" />
<link rel="manifest" href="/api/static/assets/manifest.webmanifest">
<title>Notes</title> <title>Notes</title>
</head> </head>

View File

@ -13,8 +13,10 @@
"dependencies": { "dependencies": {
"axios": "^0.18.0", "axios": "^0.18.0",
"es6-promise": "^4.2.6", "es6-promise": "^4.2.6",
"pell": "^1.0.6",
"postcss-loader": "^2.1.6", "postcss-loader": "^2.1.6",
"raw-loader": "^0.5.1", "raw-loader": "^0.5.1",
"socket.io-client": "^2.3.0",
"vue": "^2.5.2", "vue": "^2.5.2",
"vue-router": "^3.0.1", "vue-router": "^3.0.1",
"vuex": "^3.1.0" "vuex": "^3.1.0"

View File

@ -10,6 +10,8 @@
<script> <script>
// import io from 'socket.io-client'
export default { export default {
components: { components: {
'global-site-menu': require('@/components/GlobalSiteMenu.vue').default, 'global-site-menu': require('@/components/GlobalSiteMenu.vue').default,
@ -21,6 +23,12 @@ export default {
}, },
beforeCreate: function(){ beforeCreate: function(){
// const socket = io({ path:'/socket' });
const socket = this.$io
socket.on('connect', () => {
this.$store.commit('setSocketIoSocket', socket.id)
})
//Detect if user is on a mobile browser and set a flag in store //Detect if user is on a mobile browser and set a flag in store
this.$store.commit('detectIsUserOnMobile') this.$store.commit('detectIsUserOnMobile')

View File

@ -31,6 +31,7 @@ div.ui.basic.segment.no-fluf-segment {
body{ body{
color: var(--text_color); color: var(--text_color);
background-color: var(--background_color); background-color: var(--background_color);
font-family: 'Roboto', 'Helvetica Neue', Arial, Helvetica, sans-serif;
} }
.ui.form input:not([type]), .ui.form input:not([type]),
@ -96,6 +97,10 @@ div.ui.basic.green.label {
} }
/* Styles for public display pages */ /* Styles for public display pages */
a:hover {
text-decoration: underline;
}
.note-status-indicator { .note-status-indicator {
position: absolute; position: absolute;
width: 100px; width: 100px;
@ -103,12 +108,143 @@ div.ui.basic.green.label {
box-sizing: border-box; box-sizing: border-box;
text-align: center; text-align: center;
color: var(--text_color); color: var(--text_color);
bottom: 0; bottom: -13px;
right: 0; right: -7px;
z-index: 100; z-index: 100;
cursor: pointer; cursor: pointer;
} }
/* squire text styles */
.squire-box {
border: none;
height: calc(100% - 60px);
box-sizing: border-box;
padding: 10px 15px 40px;
background: transparent;
overflow-x: scroll;
/*color: var(--text_color);*/
font-size: 1.2em;
line-height: 1.5em;
word-wrap: break-word;
border-bottom: 1px solid #ccc;
}
/*Makes the first line real big */
.squire-box p:first-child {
font-size: 1.4em;
line-height: 1.7em;
}
.squire-box:focus {
outline: none;
}
.squire-box span.size {
line-height: 1.3em;
}
.squire-box a {
cursor: pointer;
}
.note-card-text i,
.squire-box i {
padding: 0.5em 0.99em;
border: 1px solid #CCC;
margin: 1px;
border-radius: 9px;
display: inline-block;
}
.squire-box p {
margin-bottom: 0;
}
.squire-box blockquote {
margin: 0;
padding: 0.8em;
border-left: 2px solid blue;
}
.note-card-text img {
max-width:100%;
height: auto;
max-height: 200px;
}
.squire-box img {
max-width:100%;
height: auto;
}
.note-card-text li > p,
.squire-box p,
.squire-box li > p {
margin-bottom: 0;
}
.note-card-text ul > li,
.squire-box ul > li {
position: relative;
list-style-type: none;
}
.note-card-text ul > li:before,
.squire-box ul > li:before {
content: "\f111";
font-family: 'Icons';
backface-visibility: hidden;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
text-align: center;
line-height: 1.4em;
font-size: 0.75em;
height: 17px;
width: 17px;
display: inline-block;
position: absolute;
left: -30px;
/*border: 2px solid #444;*/
/*border-radius: 4px;*/
bottom: 0;
top: 4px;
cursor: pointer;
opacity: 0.7;
}
ul > li.active:before {
font-family: 'Icons';
content: "\f058";
color: #21BA45;
opacity: 1;
}
/* adjust checkboxes for mobile. Make them a little bigger, easier to click */
@media only screen and (max-width: 740px) {
.note-card-text ul > li,
.squire-box ul > li {
min-height: 30px;
}
.note-card-text ul > li:before,
.squire-box ul > li:before {
content: "\f111";
font-family: outline-icons;
height: 24px;
width: 24px;
left: -40px;
bottom: 0;
top: 0px;
cursor: pointer;
line-height: 0.9em;
font-size: 1.4em;
}
ul > li.active:before {
font-family: 'Icons';
content: "\f058";
color: #21BA45;
opacity: 1;
}
}
.clickable { .clickable {
cursor: pointer; cursor: pointer;

4995
client/src/assets/squire.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,105 +2,200 @@
.attachment-display-card { .attachment-display-card {
width: 100%; width: 100%;
padding: 0 0 20px; padding: 10px;
display: inline-block; display: inline-block;
border: 1px solid;
border-color: var(--border_color);
border-radius: 4px;
margin: 0 0 15px;
max-height: 10000px;
} }
.attachment-image { .attachment-image {
width: 100%; max-width: 100%;
max-width: 150px; height: auto;
float: left; max-height: 300px;
margin: 0 15px 0 0;
} }
.image-placeholder { .image-placeholder {
width: 150px; width: 100%;
height: 60px; height: 100%;
border: 1px solid #DDD; max-height: 100px;
float: left; }
margin: 0 15px 0 0; .image-placeholder:after {
content: 'No Image';
display: block;
width: 20px;
height: 20px;
background:
green;
position: absolute;
top: 0;
left: 0;
} }
.text { .text {
width: 100%; width: 100%;
/*height: 100%;*/
background: transparent; background: transparent;
border: none; border: none;
border-top: 1px solid;
border-bottom: 1px solid; border-bottom: 1px solid;
font-size: 1.4em; border-color: var(--border_color);
margin: 0 0 10px; font-size: 1.2em;
line-height: 1.4em; line-height: 1.3em;
/*margin: 0 0 10px;*/
padding: 10px 0 10px;
color: var(--text_color);
overflow: hidden;
resize: none;
/*transition: height 0.4s ease; This breaks the resize */
} }
.link { .link {
font-size: 1.4em; font-size: 1.4em;
margin: 0 0 5px; margin: 20px 0 20px;
display: inline-block; display: inline-block;
white-space: nowrap; white-space: nowrap;
overflow:hidden; overflow:hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
width: calc(100% - 180px); width: 100%;
line-height: 1.4em; line-height: 1.4em;
} }
.flip-out {
animation: flip-out-hor-top 0.5s cubic-bezier(0.550, 0.085, 0.680, 0.530) both;
overflow: hidden;
transition: max-height 0.3s ease;
max-height: 0;
}
@keyframes flip-out-hor-top {
0% {
transform: rotateX(0);
opacity: 1;
}
100% {
transform: rotateX(70deg);
opacity: 0;
}
}
</style> </style>
<template> <template>
<div class="attachment-display-card"> <div class="attachment-display-card" :class="{ 'flip-out':!unfolded }" v-if="visible">
<div class="ui stackable grid">
<!-- image and text -->
<div class="six wide center aligned middle aligned column">
<a :href="linkUrl" target="_blank" >
<img v-if="item.file_location" class="attachment-image" :src="`/api/static/thumb_${item.file_location}`">
<span v-else>
<img class="image-placeholder" loading="lazy" src="/api/static/assets/marketing/void.svg">
No Image
</span>
<input class="text" v-on:blur="saveIt()" v-model="text"></input>
<div v-if="item.attachment_type == 1">
<div class="image-holder" v-if="item.file_location">
<a v-if="item.file_location" :href="item.url" target="_blank">
<img class="attachment-image" :src="`/api/static/${item.file_location}`">
</a> </a>
</div> </div>
<div v-else class="image-placeholder"></div>
<a class="link" v-if="item.url" :href="item.url" target="_blank">{{item.url}}</a>
</div>
<div v-if="item.attachment_type == 2">
<div class="image-holder" v-if="item.file_location">
<a v-if="item.file_location && item.type != 1" :href="`/api/static/${item.file_location}`" target="_blank">
<img class="attachment-image" :src="`/api/static/${item.file_location}`">
</a>
</div>
<div v-else class="image-placeholder"></div>
<a class="link" v-if="item.file_location && item.type != 1" :href="`/api/static/${item.file_location}`" target="_blank">Download</a>
</div>
<div class="ten wide column">
<textarea ref="edit" class="text" v-on:blur="saveIt()" v-on:keyup="checkKeyup" v-model="text"></textarea>
<!-- link -->
<a class="link" :href="linkUrl" target="_blank">{{linkText}}</a>
<!-- Buttons -->
<div class="ui small compact basic button" v-on:click="openNote"> <div class="ui small compact basic button" v-on:click="openNote">
<i class="file icon"></i>
Open Note Open Note
</div> </div>
<div class="ui small compact basic button" v-on:click="openEditAttachments"
:class="{ 'disabled':this.searchParams.noteId }">
<i class="folder icon"></i>
Note Attachments
</div>
<div class="ui small compact basic icon button" v-on:click="deleteAttachment">
<i v-if="!working" class="trash alternate outline icon"></i>
<i v-if="working" class="purple spinner loading icon icon"></i>
</div>
</div> </div>
</div>
</div>
</template> </template>
<script> <script>
import axios from 'axios' import axios from 'axios'
export default { export default {
props: [ 'item' ], props: [ 'item', 'searchParams' ],
data: function(){ data: function(){
return { return {
things: [],
text: '', text: '',
type: null,
linkText: 'Link',
linkUrl:null,
unfolded:true,
visible: true,
working: false,
} }
}, },
beforeCreate: function(){ beforeCreate: function(){
}, },
mounted: function(){ mounted: function(){
this.text = this.item.text this.text = this.item.text
this.type = this.item.attachment_type
//1 = URL, 2 = image, >= 3 files
if(this.type == 1 && this.item.url != null){
this.linkText = this.item.url
this.linkUrl = this.item.url
}
if(this.type == 2){
this.linkText = 'Download'
this.linkUrl = `/api/static/${this.item.file_location}`
}
this.$nextTick(() => {
this.checkKeyup()
})
}, },
methods: { methods: {
checkKeyup(){
let elm = this.$refs.edit
if(elm){
elm.style.height = '0'
elm.style.height = elm.scrollHeight +'px'
}
},
openNote(){ openNote(){
const noteId = this.item.note_id const noteId = this.item.note_id
this.$router.push('/notes/open/'+noteId) this.$router.push('/notes/open/'+noteId)
}, },
openEditAttachments(){
const noteId = this.item.note_id
this.$router.push('/attachments/note/'+noteId)
},
deleteAttachment(){
//No double clicks
if(this.working){ return }
this.working = true
axios.post('/api/attachment/delete', {'attachmentId':this.item.id})
.then( ({data}) => {
if(data){
this.unfolded = false
setTimeout( () => {
this.visible = false
}, 600)
}
})
},
saveIt(){ saveIt(){
//Don't save text if it didn'th change //Don't save text if it didn'th change

View File

@ -1,15 +1,41 @@
<template> <template>
<div>
<div class="color-picker" :style="{ 'background-color':allStyles['noteBackground'], 'color':allStyles['noteText']}"> <div class="color-picker" :style="{ 'background-color':allStyles['noteBackground'], 'color':allStyles['noteText']}">
<div class="floating-buttons">
<div class="ui basic segment">
<div class="ui fluid buttons">
<div class="ui compact button" v-on:click="closeThisBitch">
<i class="close icon"></i>
Close
</div>
<div class="ui compact button" v-on:click="clearStyles">
<i class="refresh icon"></i>
Clear All Styles
</div>
</div>
</div>
</div>
<div class="ui basic segment">
<div class="ui grid"> <div class="ui grid">
<div class="five wide column">
<div class="row">
<div class="sixteen wide column">
<br>
<p>Note Color</p> <p>Note Color</p>
<div v-for="color in colors" <div v-for="color in getReducedColors()"
class="color-button" class="color-button"
:style="{ backgroundColor:color }" :style="{ backgroundColor:color }"
v-on:click="chosenColor(color)" v-on:click="chosenColor(color)"
></div> ></div>
</div> </div>
<div class="six wide column"> </div>
<div class="row">
<div class="sixteen wide column">
<p>Note Icon <p>Note Icon
<span v-if="allStyles.noteIcon" > <span v-if="allStyles.noteIcon" >
<i :class="`large ${allStyles.noteIcon} icon`" :style="{ 'color':allStyles.iconColor }"></i> <i :class="`large ${allStyles.noteIcon} icon`" :style="{ 'color':allStyles.iconColor }"></i>
@ -18,18 +44,26 @@
<div v-for="icon in icons" class="icon-button" v-on:click="chosenIcon(icon)" > <div v-for="icon in icons" class="icon-button" v-on:click="chosenIcon(icon)" >
<i :class="`large ${icon} icon`" :style="{ 'color':allStyles.iconColor }"></i> <i :class="`large ${icon} icon`" :style="{ 'color':allStyles.iconColor }"></i>
</div> </div>
<div class="ui compact fluid button" v-on:click="clearStyles">Clear All Styles</div>
</div> </div>
<div class="five wide column"> </div>
<div class="row">
<div class="sixteen wide column">
<p>Icon Color</p> <p>Icon Color</p>
<div v-for="color in colors" <div v-for="color in getReducedColors()"
class="color-button" class="color-button"
:style="{ backgroundColor:color }" :style="{ backgroundColor:color }"
v-on:click="chooseIconColor(color)" v-on:click="chooseIconColor(color)"
></div> >
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</div>
<div class="shade-boy" v-on:click="closeThisBitch"></div>
</div>
</template> </template>
<script> <script>
@ -55,9 +89,33 @@
this.allStyles = this.styleObject this.allStyles = this.styleObject
}, },
methods: { methods: {
getReducedColors(){
let reduced = []
this.colors.forEach((color,i) => {
if(i%20 <= 10){
return
}
let mod = (i % 10)+1 //1 - 10
let lines = [3, 5, 8, 9, 10]
if(lines.includes(mod)){
reduced.push(color)
}
})
reduced.push("#000")
return reduced
},
clearStyles(){ clearStyles(){
this.$emit('changeColor', this.blankStyle) this.$emit('changeColor', this.blankStyle)
}, },
closeThisBitch(){
this.$emit('close')
},
chosenColor(inColor){ chosenColor(inColor){
//Set not background to color that was chosen //Set not background to color that was chosen
@ -99,33 +157,55 @@
} }
</script> </script>
<style type="text/css" scoped> <style type="text/css" scoped>
.shade-boy {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 250;
cursor: pointer;
}
.floating-buttons {
position: fixed;
top: 0;
z-index: 444;
right: 20px;
left: calc(30% + 10px)
}
.color-picker { .color-picker {
color: var(--text_color); color: var(--text_color);
background-color: var(--background_color); background-color: var(--background_color);
position: absolute; position: fixed;
/*height: 100px;*/ /*height: 100px;*/
top: 37px; top: 0;
right: 0;
left: 30%;
bottom: 0;
padding: 10px; padding: 10px;
border-radius: 5px;
left: -63px; z-index: 500;
z-index: 300; border-left: 1px solid;
border: 1px solid;
border-color: var(--border_color) !important; border-color: var(--border_color) !important;
width: 750px; overflow-x: scroll;
} }
.icon-button { .icon-button {
height: 30px; height: 40px;
width: 30px; width: 14.2%;
display: inline-block; display: inline-block;
cursor: pointer; cursor: pointer;
font-size: 1.3em;
} }
.color-button { .color-button {
height: 20px; height: 50px;
width: 20px; width: 20%;
display: inline-block; display: block;
cursor: pointer; cursor: pointer;
float: left;
} }
</style> </style>

View File

@ -2,21 +2,20 @@
.hidden-up { .hidden-up {
opacity: 0; opacity: 0;
position: absolute; position: absolute;
top: -500px; top: -50000px;
} }
</style> </style>
<template> <template>
<div class="ui small compact basic icon button clickable">
<form> <form>
<label :for="`upfile-${noteId}`" class="clickable"> <label :for="`upfile-${noteId}`" class="clickable">
<i class="upload icon"></i> <i class="upload icon"></i>
Upload File <span v-if="uploadPercentage != 0">{{uploadPercentage}}%</span> <span v-if="uploadPercentage != 0">{{uploadPercentage}}%</span>
<span v-else>Upload</span>
</label> </label>
<input class="hidden-up" type="file" :id="`upfile-${noteId}`" ref="file" v-on:change="handleFileUpload()" /> <input class="hidden-up" type="file" :id="`upfile-${noteId}`" ref="file" v-on:change="handleFileUpload()" />
</form>
<!-- <button v-if="file" v-on:click="uploadFileToServer()">Submit</button> --> <!-- <button v-if="file" v-on:click="uploadFileToServer()">Submit</button> -->
</div> </form>
</template> </template>
<script> <script>
@ -50,37 +49,26 @@
} }
} }
).then(results => { ).then(results => {
this.uploadPercentage = 0 this.uploadPercentage = 'Working'
this.file = null this.file = null
console.log('SUCCESS!!');
console.log('File upload results') // console.log('File upload results')
console.log(results.data) // console.log(results.data)
const name = results.data.fileName const name = results.data.fileName
const location = results.data.fileLocation const location = results.data.goodFileName
if(name && location){ if(name && location){
const imageCode = `<img alt="yup" height="200px" src="/api/static/${location}">` this.uploadPercentage = 0
//put cursor at the bottom of the window const imageCode = `<img alt="image" src="/api/static/${location}">`
tinyMCE.activeEditor.selection.select(tinyMCE.activeEditor.getBody(), true);
tinyMCE.activeEditor.selection.collapse(false); this.$bus.$emit('new_file_upload', {noteId: this.noteId, imageCode})
tinymce.activeEditor.execCommand('mceInsertContent', false, imageCode)
} }
//try and stick that file into the active editor
// tinyMCE.execCommand(
// 'mceInsertContent',
// false,
// '<img alt="Smiley face" height="42" width="42" src="' + src + '"/>'
// );
}) })
.catch(results => { .catch(results => {
this.uploadPercentage = 0 this.uploadPercentage = 0
console.log('FAILURE!!');
}) })
}, },
handleFileUpload() { handleFileUpload() {

View File

@ -21,12 +21,15 @@
.menu-item { .menu-item {
color: #fff; color: #fff;
padding: 0.8em 0px 0.8em 0.8em; padding: 0.8em 0px 0.8em 10px;
display: inline-block; display: inline-block;
width: 100%; width: 100%;
font-size: 1.15em; font-size: 1.15em;
box-sizing: border-box; box-sizing: border-box;
} }
.menu-item i.icon {
margin-right: 10px;
}
.sub { .sub {
padding-left: 20px; padding-left: 20px;
} }
@ -40,6 +43,7 @@
} }
.menu-button:hover { .menu-button:hover {
background-color: #534c68; background-color: #534c68;
text-decoration: none;
} }
.router-link-active i { .router-link-active i {
@ -92,12 +96,20 @@
<div class="top-menu-bar" v-if="(collapsed || mobile) && !menuOpen"> <div class="top-menu-bar" v-if="(collapsed || mobile) && !menuOpen">
<div class="ui grid"> <div class="ui grid">
<div class="three wide column"> <div class="seven wide column">
<div class="ui large basic compact icon button" v-on:click="collapseMenu"> <div class="ui large basic compact icon button" v-on:click="collapseMenu">
<i class="green bars icon"></i> <i class="green bars icon"></i>
</div> </div>
<router-link class="ui large basic compact icon button" to="/notes" v-on:click.native="emitReloadEvent()">
<i class="green home icon"></i>
</router-link>
<div v-on:click="toggleNightMode" class="ui large basic compact icon button">
<i class="green moon outline icon"></i>
</div> </div>
<div class="ten wide center aligned column"> </div>
<div class="six wide center aligned column">
<img v-if="!loggedIn" src="/api/static/assets/favicon.ico" alt="logo" /> <img v-if="!loggedIn" src="/api/static/assets/favicon.ico" alt="logo" />
<search-input v-if="loggedIn"></search-input> <search-input v-if="loggedIn"></search-input>
</div> </div>
@ -126,7 +138,7 @@
<div class="menu-section"> <div class="menu-section">
<div class="menu-item menu-button" v-on:click="collapseMenu"> <div class="menu-item menu-button" v-on:click="collapseMenu">
<i class="caret square left outline icon"></i> <i class="angle left icon"></i>
</div> </div>
</div> </div>
@ -144,16 +156,22 @@
<i class="file icon"></i>Notes <i class="file icon"></i>Notes
</router-link> </router-link>
<div> <div>
<div class="menu-item sub">Show Only <i class="caret down icon"></i></div> <!-- <div class="menu-item sub">Show Only <i class="caret down icon"></i></div> -->
<div v-on:click="updateFastFilters(0)" class="menu-item menu-button sub"><i class="grey linkify icon"></i>Links</div> <!-- <div v-on:click="updateFastFilters(0)" class="menu-item menu-button sub"><i class="grey linkify icon"></i>Links</div> -->
<div v-on:click="updateFastFilters(1)" class="menu-item menu-button sub"><i class="grey tags icon"></i>Tags</div> <!-- <div v-on:click="updateFastFilters(1)" class="menu-item menu-button sub"><i class="grey tags icon"></i>Tags</div> -->
<div v-on:click="updateFastFilters(2)" class="menu-item menu-button sub"><i class="grey archive icon"></i>Archived</div>
</div>
</div>
<div class="menu-section" v-if="loggedIn">
<div v-on:click="updateFastFilters(2)" class="menu-item menu-button">
<i class="archive icon"></i>Archived
</div> </div>
</div> </div>
<div class="menu-section" v-if="loggedIn"> <div class="menu-section" v-if="loggedIn">
<router-link class="menu-item menu-button" exact-active-class="active" to="/attachments"> <router-link class="menu-item menu-button" exact-active-class="active" to="/attachments">
<i class="folder icon"></i>Attachments <i class="folder icon"></i>Files
</router-link> </router-link>
</div> </div>
@ -176,9 +194,9 @@
<div class="menu-section"> <div class="menu-section">
<div v-on:click="toggleNightMode" class="menu-item menu-button"> <div v-on:click="toggleNightMode" class="menu-item menu-button">
<span v-if="$store.getters.getIsNightMode"> <span v-if="$store.getters.getIsNightMode">
<i class="toggle on icon"></i>Dark Theme</span> <i class="moon outline icon"></i>Light Theme</span>
<span v-else> <span v-else>
<i class="toggle off icon"></i>Dark Theme</span> <i class="moon outline icon"></i>Dark Theme</span>
</div> </div>
</div> </div>
@ -266,7 +284,6 @@
}, },
toggleNightMode(){ toggleNightMode(){
this.$store.commit('toggleNightMode') this.$store.commit('toggleNightMode')
this.$bus.$emit('toggle_night_mode')
}, },
ucWords(str){ ucWords(str){
return (str + '') return (str + '')

View File

@ -4,7 +4,7 @@
id="InputNotes" id="InputNotes"
class="master-note-edit" class="master-note-edit"
@keyup.esc="close" @keyup.esc="close"
:class="[{'size-down':(sizeDown == true)}, 'position-'+position ]" :class="[{'size-down':(sizeDown == true), 'padded-bottom':extraToolbarsVisible }, 'position-'+position ]"
:style="{ 'background-color':styleObject['noteBackground'], 'color':styleObject['noteText']}" :style="{ 'background-color':styleObject['noteBackground'], 'color':styleObject['noteText']}"
> >
@ -15,64 +15,83 @@
</div> </div>
</div> </div>
<span class="note-status-indicator" v-on:click="save()">{{statusText}}</span> <div class="note-menu">
<div class="tinymce-container"> <div class="nm-button" v-on:click="close">
<textarea :id="noteid+'-tinymce-editor'">{{noteText}}</textarea> <i class="close icon"></i>
</div> </div>
<div class="nm-button" v-on:click="toggleList('ol')">
<i class="list ol icon"></i>
</div>
<div class="nm-button" v-on:click="toggleList('ul')">
<i class="tasks icon"></i>
</div>
<div class="nm-button" v-on:click="toggleBold()">
<i class="bold icon"></i>
</div>
<div class="nm-button" v-on:click="toggleItalic()">
<i class="quote left icon"></i>
</div>
<div class="nm-button" v-on:click="modifyFont('2.286em') ">
<i class="text height icon"></i>
</div>
<div v-if="usersOnNote > 1" class="nm-button">
<i class="green user circle icon"></i>{{usersOnNote}}
</div>
</div>
<div id="squire-id" class="squire-box" ref="squirebox"></div>
<!-- && this.$store.getters.getIsUserOnMobile -->
<span class="note-status-indicator" v-on:click="save()" v-if="statusText != 'Saved' && $store.getters.getIsUserOnMobile">
<div class="ui green button">{{statusText}}</div>
</span>
<color-picker <color-picker
v-if="colorPickerVisible" v-if="colorPickerVisible"
:location="colorPickerLocation" :location="colorPickerLocation"
@changeColor="onChangeColor" @changeColor="onChangeColor"
@close="onCloseColorChanger"
:style-object="styleObject" :style-object="styleObject"
/> />
<div v-if="$store.getters.getIsNoteSettingsOpen"> <!-- Note options on the bottom of note -->
<div class="all-settings" :class="{ 'low-settings':!extraToolbarsVisible }">
<div class="all-settings"> <div class="note-menu">
<div class="ui grid">
<div class="row">
<div class="sixteen wide column">
<note-tag-edit :noteId="noteid" :key="'tags-for-note-'+noteid"/><br> <!-- <note-tag-edit :noteId="noteid" :key="'tags-for-note-'+noteid"/><br> -->
<!-- close button -->
<div class="ui small compact basic icon button" v-on:click="$store.commit('toggleNoteSettingsPane')">
<i class="close icon"></i> Close Settings
</div>
<!-- Pin Button --> <!-- Pin Button -->
<div @click="onToggleArchived" class="ui small compact basic icon button"> <div @click="onToggleArchived" class="nm-button">
<i class="archive icon" :class="{green:(archived == 1)}"></i> <i class="archive icon" :class="{green:(archived == 1)}"></i>
{{(archived == 1)?'Archived':'Archive'}} {{(archived == 1)?'Archived':'Archive'}}
</div> </div>
<!-- archive button --> <!-- archive button -->
<div @click="onTogglePinned" class="ui small compact basic icon button"> <div @click="onTogglePinned" class="nm-button">
<i class="pin icon" :class="{green:(pinned == 1)}"></i> <i class="pin icon" :class="{green:(pinned == 1)}"></i>
{{(pinned == 1)?'Pinned':'Pin'}} {{(pinned == 1)?'Pinned':'Pin'}}
</div> </div>
<!-- colors button --> <!-- colors button -->
<span class="relative" v-on:click="showColorPicker"> <span class="nm-button" v-on:click="showColorPicker">
<span class="ui small compact basic icon button">
<i class="paint brush icon"></i> <i class="paint brush icon"></i>
Colors Colors
</span> </span>
</span>
<!-- attachment button --> <!-- attachment button -->
<div v-if="attachmentCount > 0" class="ui small compact basic icon button" v-on:click="openEditAttachment"> <div class="nm-button" v-on:click="openEditAttachment">
<i class="folder icon"></i> Attachments <i class="folder icon"></i> Files
</div> </div>
<!-- file upload button --> <!-- file upload button -->
<file-upload-button :noteId="noteid" /> <file-upload-button class="nm-button" :noteId="noteid" />
</div>
</div>
</div> </div>
</div> </div>
<!-- <div class="shade" v-on:click="showAllSettings = false"></div> --> <!-- <div class="shade" v-on:click="showAllSettings = false"></div> -->
</div>
</div> </div>
</template> </template>
@ -80,6 +99,7 @@
<script> <script>
import axios from 'axios' import axios from 'axios'
const DiffMatchPatch = require('../../../server/helpers/DiffMatchPatch')
export default { export default {
name: 'InputNotes', name: 'InputNotes',
@ -96,11 +116,13 @@
loadingMessage: 'Loading Note', loadingMessage: 'Loading Note',
currentNoteId: 0, currentNoteId: 0,
noteText: '', noteText: '',
diffNoteText: '',
statusText: 'Saved', statusText: 'Saved',
lastNoteHash: null, lastNoteHash: null,
saveDebounce: null, //Prevent save from being called numerous times quickly saveDebounce: null, //Prevent save from being called numerous times quickly
updated: 'Never', updated: 'Never',
editDebounce: null, editDebounce: null,
emitChangeDebounce: null,
keyPressesCounter: 0, //Determen keys pressed between saves keyPressesCounter: 0, //Determen keys pressed between saves
pinned: 0, pinned: 0,
archived: 0, archived: 0,
@ -116,6 +138,13 @@
//Settings vars //Settings vars
showAllSettings: true, showAllSettings: true,
lastVisibilityState: null, lastVisibilityState: null,
//All the squire settings
editor: null,
// pastFocusedNode: null,
usersOnNote: 0,
extraToolbarsVisible: true,
} }
}, },
watch: { watch: {
@ -135,136 +164,189 @@
} }
}, },
beforeMount(){ beforeMount(){
//Load tinymce into the page only do it once this.$bus.$on('new_file_upload', ({noteId, imageCode}) => {
if(document.querySelectorAll('[data-mceload]').length == 0){ if(this.noteid == noteId && this.editor){
let tinyMceIncluder = document.createElement('script') this.editor.moveCursorToEnd()
tinyMceIncluder.setAttribute('src', '/api/static/assets/tinymce/tinymce.min.js') this.editor.insertHTML(imageCode)
tinyMceIncluder.setAttribute('data-mceload','loaded')
document.head.appendChild(tinyMceIncluder)
} }
})
}, },
beforeDestroy(){ beforeDestroy(){
document.removeEventListener('visibilitychange', this.visibiltyChangeAction) this.$io.emit('leave_room', this.noteid)
// this.$off() // Remove all event listeners document.removeEventListener('visibilitychange', this.checkForUpdatedNote)
// this.$bus.$off()
//Trash editor instance on close this.editor.destroy()
this.tinymce.remove()
this.$bus.$off('new_file_upload')
}, },
mounted: function() { mounted: function() {
//Change TinyMce styles on nightmored change
this.$bus.$on('toggle_night_mode', this.setEditorTextColor )
document.addEventListener('visibilitychange', this.checkForUpdatedNote) document.addEventListener('visibilitychange', this.checkForUpdatedNote)
this.$nextTick(() => { this.$nextTick(() => {
this.loadNote(this.noteid) this.loadNote(this.noteid)
//Tell server to push this note into a room
this.$io.emit('join_room', this.noteid)
this.$io.on('update_user_count', userCount => {
this.usersOnNote = userCount
}) })
//Server will hand deliver diffs from other notes to this one
this.$io.on('incoming_diff', incomingDiffData => {
this.patchText(incomingDiffData)
})
})
}, },
methods: { methods: {
initTinyMce(){ initSquire(){
// image_list: [ //Set up squire and load note text
// {title: 'My image 1', value: 'https://www.tinymce.com/my1.gif'}, this.editor = new Squire( this.$refs.squirebox, {blockTag: 'p' })
// {title: 'My image 2', value: 'http://www.moxiecode.com/my2.gif'} this.setText(this.noteText)
// ]
//Default plugin options for big browsers //Open links when clicked in editor
let toolbarOptions = 'customCloseButton | mceTogglePinned | forecolor styleselect | bold italic underline | link | bullist numlist | outdent indent table | h | image' this.editor.addEventListener('click', e => {
let pluginOptions = 'paste, link, code, lists, table, hr, image'
//Tweak doc height for mobile //Link clicked in editor - open link
let docHeight = 'calc(100vh - 1px)' if(e.target.nodeName == 'A' && e.target.href){
window.open(e.target.href)
}
//List Item clicked in editor - toggle link state
if(e.target.nodeName == 'LI'){
let el = e.target
//Adjust ofset by 40 px
let correction = 40
//Determine if element was clicked or area before it, before means checkbox was clicked
if (e.offsetX > e.target.offsetLeft - correction) {
//Element was clicked
} else {
//Will hide keyboard if clicked, much better for mobile
this.editor.blur()
//Area before element was clicked, they clicked the checkbox
this.onKeyup()
if (el.className === 'active'){
el.className = 'inactive';
} else {
el.className = 'active';
}
}
}
})
this.editor.addEventListener('keydown', event => {
//Prevent new list items from having
this.$nextTick( () => {
//Wait a moment to get item under cursor
let selection = this.editor.getSelection()
let container = selection.commonAncestorContainer
//If user hit enter on a list, make sure the next list item isn't active
if(container.nodeName == 'LI' && event.keyCode == 13 && container.classList){
container.classList.remove('active')
}
})
})
//Bind event handlers
this.editor.addEventListener('keyup', event => this.onKeyup(event) )
//Show and hide additional toolbars
this.editor.addEventListener('focus', e => {
if(this.$store.getters.getIsUserOnMobile){ if(this.$store.getters.getIsUserOnMobile){
docHeight = 'calc(100vh - 1px)' this.extraToolbarsVisible = false
toolbarOptions = 'customCloseButton | bullist numlist | mceTogglePinned'
pluginOptions = 'lists'
}
//setup skin as dark if night mode is enabled
let skin = 'oxide'
if(this.$store.getters.getIsNightMode){
skin = 'oxide-dark'
}
const editorId = '#'+this.noteid+'-tinymce-editor'
let vm = this
//Globally defined included in index HTML
tinymce.init({
selector: editorId,
toolbar: toolbarOptions,
plugins: pluginOptions,
browser_spellcheck: true,
menubar: false,
branding: false,
statusbar: false,
height: docHeight,
skin: skin,
contextmenu: false,
init_instance_callback: this.editorInitCallback,
imagetools_toolbar: "imageoptions",
setup: editor => {
//Add custom buttons to tinymce instance
editor.ui.registry.addButton('customCloseButton', {
text: 'Close',
icon: 'close',
onAction: function (_) {
vm.close()
} }
}) })
this.editor.addEventListener('blur', e => {
//Add custom buttons to tinymce instance this.save()
editor.ui.registry.addButton('mceTogglePinned', { this.extraToolbarsVisible = true
text: 'Note Settings',
icon: 'settings',
onAction: function (_) {
vm.$store.commit('toggleNoteSettingsPane')
}
})
}
}) })
}, },
editorInitCallback(editor){ //If nothing is selected, select the entire line
selectLineIfNoSelect(){
//Select entire line if range is not set
let selection = this.editor.getSelection()
this.loading = false //Turn off loading screed when editor is loaded if(selection.startOffset == selection.endOffset && selection.startContainer == selection.endContainer){
this.tinymce = editor
this.setEditorTextColor() let squireRange = this.editor.createRange(
selection.startContainer, 0,
editor selection.endContainer, selection.commonAncestorContainer.textContent.length)
.on('Change', this.onKeyup )
.on('keyup', this.onKeyup )
.on('blur', this.save )
this.editor.setSelection(squireRange)
}
}, },
setEditorTextColor(){ modifyFont(inSize){
//Only Set editor text color, background is transparent and set on parent element this.selectLineIfNoSelect()
//There may be scenarios where editor has not been set up let fontInfo = this.editor.getFontInfo()
if(this.tinymce){ //Toggle font size between large and normal
//Set editor color to color from app, change with night mode if(fontInfo.size){
this.tinymce.getBody().style.color = getComputedStyle(document.documentElement) this.editor.setFontSize(null)
.getPropertyValue('--text_color'); } else {
this.editor.setFontSize(inSize)
//Overwrite set color if theme is set for note.
if(this.styleObject && this.styleObject.noteText){
this.tinymce.getBody().style.color = this.styleObject.noteText
} }
},
toggleList(type){
//Undo list if its already a lits
if(this.editor.hasFormat(type)){
this.editor.removeList()
return
} }
if(type == 'ol'){
this.editor.makeOrderedList()
}
if(type == 'ul'){
this.editor.makeUnorderedList()
}
},
toggleBold(){
this.selectLineIfNoSelect()
if( this.editor.hasFormat('b') ){
this.editor.removeBold()
} else {
this.editor.bold()
}
},
toggleItalic(){
this.selectLineIfNoSelect()
if( this.editor.hasFormat('i') ){
this.editor.removeItalic()
} else {
this.editor.italic()
}
}, },
setText(inText){ setText(inText){
return this.tinymce.setContent(inText)
this.editor.setHTML(inText)
this.noteText = this.editor._getHTML()
this.diffNoteText = this.editor._getHTML()
}, },
getText(){ getText(){
//Return text from tinyMce Editor
return this.tinymce.getContent() return this.editor.getHTML()
}, },
showColorPicker(event){ showColorPicker(event){
this.colorPickerVisible = !this.colorPickerVisible this.colorPickerVisible = !this.colorPickerVisible
@ -293,13 +375,14 @@
this.lastNoteHash = 0 this.lastNoteHash = 0
this.save() this.save()
}, },
onCloseColorChanger(){
this.colorPickerVisible = false
},
onChangeColor(newStyleObject){ onChangeColor(newStyleObject){
//Set new style object for note, page will use some styles, styles will be saved to database //Set new style object for note, page will use some styles, styles will be saved to database
this.styleObject = newStyleObject this.styleObject = newStyleObject
this.setEditorTextColor()
this.lastNoteHash = 0 //Update hash to force note update on next save this.lastNoteHash = 0 //Update hash to force note update on next save
this.save() this.save()
}, },
@ -320,11 +403,15 @@
//Set up local data //Set up local data
vm.currentNoteId = noteId vm.currentNoteId = noteId
vm.noteText = response.data.text vm.noteText = response.data.text
vm.diffNoteText = response.data.text
vm.updated = response.data.updated vm.updated = response.data.updated
vm.lastNoteHash = vm.hashString(response.data.text) vm.lastNoteHash = vm.hashString(response.data.text)
//Set up note colors
if(response.data.color){ if(response.data.color){
vm.styleObject = JSON.parse(response.data.color) //Load styles json from DB vm.styleObject = JSON.parse(response.data.color)
} }
if(response.data.pinned != null){ if(response.data.pinned != null){
@ -333,8 +420,11 @@
vm.archived = response.data.archived vm.archived = response.data.archived
vm.attachmentCount = response.data.attachment_count vm.attachmentCount = response.data.attachment_count
this.loading = false
vm.$nextTick(() => { vm.$nextTick(() => {
this.initTinyMce() // this.initTinyMce()
this.initSquire()
}) })
}) })
@ -342,9 +432,176 @@
console.log('Could not fetch note') console.log('Could not fetch note')
} }
}, },
onKeyup(){ diffText(){
this.statusText = 'Modified' // dont emit to one user
if(this.usersOnNote <= 1){
return
}
//Post latest diff to server, server will emit change event to all connected clients
// clearTimeout(this.emitChangeDebounce)
this.emitChangeDebounce = setTimeout(i => {
//caldulate text diff
let oldText = this.diffNoteText
let newText = this.getText()
if(oldText == newText){
return
}
const dmp = new DiffMatchPatch.diff_match_patch()
const diff = dmp.diff_main(oldText, newText)
// dmp.diff_cleanupSemantic(diff)
const patch_list = dmp.patch_make(oldText, newText, diff);
const patch_text = dmp.patch_toText(patch_list);
var patches = dmp.patch_fromText(patch_text);
var results = dmp.patch_apply(patches, oldText);
const computedText = results[0]
//Save computed diff text
this.noteText = computedText
this.diffNoteText = computedText
if(patch_text == ''){
return
}
// console.log(patch_text)
this.$io.emit('note_diff', {
id:this.currentNoteId,
diff:patch_text
})
}, 5)
},
patchText(patch_text){
console.log(patch_text)
//
// Capture x,y of caret and position into string
//
let currentSelection = this.editor.getSelection()
let lineText = currentSelection.startContainer.textContent
console.log(lineText)
let cursorOffset = parseInt(currentSelection.startOffset) //number of characters in
let path = this.xpath(currentSelection.commonAncestorContainer.parentElement)
console.log(path)
//
//Set up text to process diff
//
let currentText = this.editor._getHTML()
const startingLines = (currentText.match(/<br>/g) || '').length + 1
console.log('1')
const dmp = new DiffMatchPatch.diff_match_patch()
var patches = dmp.patch_fromText(patch_text);
var results = dmp.patch_apply(patches, currentText);
let newText = results[0]
console.log('2')
this.noteText = newText
this.diffNoteText = newText
console.log('3')
// this.editor._setHTML(newText)
this.editor.setHTML(newText)
console.log('4')
//
// I user hasn't selected the document, we are done here
// @TODO add code to halt execution
//
const endingLines = (newText.match(/<br>/g) || '').length + 1
// if(this.pastFocusedNode != null || true){
setTimeout( ()=>{
var root = this.editor.getRoot()
//Get node under current x,y on dom (may break on scroll)
// let node = document.elementFromPoint(mouse.x, mouse.y)
let node = this.getElementByXPath(path)
if(node.firstChild){
node = node.firstChild
}
//If the number of lines changed
if(startingLines != endingLines){
//Line diff may be +1 or -1
let lineDiff = endingLines - startingLines
console.log('Line Diff => ', lineDiff)
//Pull out node number from path
var nodeNumber = path.match(/\d+/)
let modifyNode = null
if(nodeNumber.length == 1){
modifyNode = parseInt(nodeNumber[0])
}
path = path.replace(modifyNode, modifyNode + lineDiff )
console.log(path)
let maybeNext = this.getElementByXPath(path)
if(maybeNext && maybeNext.firstChild){
maybeNext = maybeNext.firstChild
}
if(maybeNext && maybeNext.textContent == lineText){
node = maybeNext
console.log('The Node Moved!')
}
}
console.log('Targeting Node')
console.log(node)
//Create and set range
let squireRange = this.editor.createRange(node, cursorOffset)
squireRange.collapse(true)
this.editor.setSelection(squireRange)
console.log('cursor set')
}, 20)
// }
},
xpath(el) {
//Skip things we can't use
if (typeof el == "string") return document.evaluate(el, document, null, 0, null)
if (!el || el.nodeType != 1) return ''
//Anchor xpath using Ids or test-ids
const testId = el.getAttribute('test-id')
if (el.id) return "//*[@id='" + el.id + "']"
//Continue to build path
const sames = [].filter.call(el.parentNode.children, function (x) { return x.tagName == el.tagName })
return this.xpath(el.parentNode) + '/' + el.tagName.toLowerCase() + (sames.length > 1 ? '['+([].indexOf.call(sames, el)+1)+']' : '')
},
getElementByXPath(xpath) {
return new XPathEvaluator()
.createExpression(xpath)
.evaluate(document, XPathResult.FIRST_ORDERED_NODE_TYPE) .singleNodeValue
},
onKeyup(event){
this.statusText = 'Save'
this.diffText()
//Each note, save after 5 seconds, focus lost or 30 characters typed. //Each note, save after 5 seconds, focus lost or 30 characters typed.
clearTimeout(this.editDebounce) clearTimeout(this.editDebounce)
@ -364,6 +621,8 @@
//Clear other debounced events to prevent double calling of save //Clear other debounced events to prevent double calling of save
// clearTimeout(this.editDebounce) // clearTimeout(this.editDebounce)
// return resolve(true)
//Don't save note if its hash doesn't change //Don't save note if its hash doesn't change
const currentNoteText = this.getText() const currentNoteText = this.getText()
if( this.lastNoteHash == this.hashString( currentNoteText )){ if( this.lastNoteHash == this.hashString( currentNoteText )){
@ -406,9 +665,12 @@
}, },
checkForUpdatedNote(){ checkForUpdatedNote(){
// return
//If user leaves page then returns to page, reload the first batch //If user leaves page then returns to page, reload the first batch
if(this.lastVisibilityState == 'hidden' && document.visibilityState == 'visible'){ if(this.lastVisibilityState == 'hidden' && document.visibilityState == 'visible'){
console.log('Checking for changes is note data') console.log('Checking for note updates after visibility change.')
const postData = { const postData = {
noteId:this.currentNoteId, noteId:this.currentNoteId,
text:this.getText(), text:this.getText(),
@ -435,12 +697,12 @@
hashString(text){ hashString(text){
var hash = 0; var hash = 0;
if (text.length == 0) { if (text == null || text.length == 0) {
return hash; return hash;
} }
//Simplified for speed //Simplified for speed
return text.length // return text.length
for (let i = 0; i < text.length; i++) { for (let i = 0; i < text.length; i++) {
let char = text.charCodeAt(i); let char = text.charCodeAt(i);
@ -472,42 +734,67 @@
<style type="text/css" scoped> <style type="text/css" scoped>
/* squire note menu button */
.note-menu {
width: 100%;
display: block;
background: #221f2b;
color: white;
overflow: hidden;
border: 1px solid #534c68;
}
.note-menu > .nm-button {
padding: 10px 10px;
cursor: pointer;
text-align: center;
box-sizing: border-box;
font-size: 1.1em;
vertical-align: middle;
/*height: 40px;*/
display: table-cell;
}
.nm-button > i {
font-size: 1.1em;
margin: 0;
}
.nm-button:hover {
background-color: #534c68;
color: white;
}
.nm-button + .nm-button {
border-left: 1px solid #534c68;
}
/* squire styles */
/*Settings manager styles */ /*Settings manager styles */
.all-settings { .all-settings {
/*border-top: 1px solid #534c68;*/
background: #221f2b;
position: absolute; position: absolute;
bottom: -5px; bottom: 0;
right: 10px; right: 0;
left: 10px; left: 0;
z-index: 99; z-index: 99;
border: 1px solid; /*border: 1px solid;*/
background-color: var(--background_color); /*background-color: var(--background_color);*/
border-color: var(--border_color); /*border-color: var(--border_color);*/
box-sizing: border-box; box-sizing: border-box;
border-radius: 7px; /*border-radius: 7px;*/
box-shadow: 0px 3px 7px 0px rgba(140,140,140,1); /*box-shadow: 0px 3px 7px 0px rgba(140,140,140,1);*/
padding: 1em; /*padding: 1.2em 0 0;*/
}
.low-settings {
bottom: 0px;
cursor: pointer;
height: 1.4em;
padding-top: 1.5em;
overflow: hidden;
border: 1px solid #534c68;
} }
/*End Settings manager styles */ /*End Settings manager styles */
.tinymce-container {
/* Uncomment this to see the */
/*border-bottom: 2px solid green !important;*/
}
.note-top-menu {
width: 100%;
display: inline-block;
height: 37px;
border-left: 3px solid var(--border_color);
}
.note-top-menu .ui.basic.button {
border-radius: 0;
border: none;
border-right: 1px solid var(--border_color);
margin: 0px -2px;
padding-left: 15px;
padding-right: 15px;
}
/* container styles change based on mobile and number of open screens */ /* container styles change based on mobile and number of open screens */
.master-note-edit { .master-note-edit {
@ -520,6 +807,9 @@
z-index: 1001; z-index: 1001;
/*overflow-x: scroll;*/ /*overflow-x: scroll;*/
} }
.padded-bottom {
padding-bottom: 20px;
}
.loading-note { .loading-note {
position: absolute; position: absolute;
top: 0; top: 0;

View File

@ -13,7 +13,7 @@
<!-- Show title and snippet below it --> <!-- Show title and snippet below it -->
<div class="top aligned row" @click.self="onClick(note.id)"> <div class="top aligned row" @click.self="onClick(note.id)">
<div class="sixteen wide column overflow-hidden" @click="e => onClick(note.id, e)"> <div class="sixteen wide column overflow-hidden note-card-text" @click="e => onClick(note.id, e)">
<!-- Title display --> <!-- Title display -->
<div v-if="note.title.length > 0" <div v-if="note.title.length > 0"
@ -190,7 +190,8 @@
border-radius: .28571429rem; border-radius: .28571429rem;
border: 1px solid; border: 1px solid;
border-color: var(--border_color); border-color: var(--border_color);
width: calc(33.333% - 10px); /*width: calc(33.333% - 10px);*/
width: calc(25% - 10px);
/*transition: box-shadow 0.3s;*/ /*transition: box-shadow 0.3s;*/
box-sizing: border-box; box-sizing: border-box;
cursor: pointer; cursor: pointer;
@ -204,6 +205,7 @@
} }
.icon-bar { .icon-bar {
opacity: 0.8; opacity: 0.8;
margin-top: -2.2rem;
} }
.hover-hide { .hover-hide {
opacity: 0.0; opacity: 0.0;

View File

@ -1,5 +1,6 @@
// The Vue build version to load with the `import` command // The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias. // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
@ -28,7 +29,18 @@ require('./assets/themes/default/assets/fonts/outline-icons.ttf')
require('./assets/themes/default/assets/fonts/outline-icons.woff') require('./assets/themes/default/assets/fonts/outline-icons.woff')
require('./assets/themes/default/assets/fonts/outline-icons.woff2') require('./assets/themes/default/assets/fonts/outline-icons.woff2')
require('./assets/squire.js')
//Import socket io, init using nginx configured socket path
import io from 'socket.io-client';
const socket = io({ path:'/socket' });
//integrate connected socket into vue instance
Object.defineProperties(Vue.prototype, {
$io: {
get: () => socket
}
})
@ -46,7 +58,7 @@ import Helpers from './Helpers'
Vue.use(Vuex) Vue.use(Vuex)
Vue.config.productionTip = false Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({ new Vue({
el: '#app', el: '#app',
router, router,

View File

@ -6,21 +6,34 @@
<h2 class="ui header"> <h2 class="ui header">
<i class="folder icon"></i> <i class="folder icon"></i>
<div class="content"> <div class="content">
Attachments Files
<div class="sub header">Files and scraped web pages from notes</div> <div class="sub header">Uploaded Files and Websites from notes.</div>
</div> </div>
</h2> </h2>
</div> </div>
<div class="ui segment" v-if="searchParams.noteId"> <div class="sixteen wide column" v-if="searchParams.noteId">
Showing Attachments for note. <div class="ui button" v-on:click="clearNote">Clear</div> <div class="ui green button" v-on:click="clearNote">
<i class="chevron circle left icon"></i>
Show All Attachments
</div>
<div class="ui green button" v-on:click="openNote">
<i class="file icon"></i>
Open Note
</div>
</div> </div>
<div class="ui basic segment"> <div class="sixteen wide column" v-if="searchParams['noteId'] && attachments.length == 0">
<h3>There are no attachments for this note.</h3>
<h3>Attachments are links or files added to the note.</h3>
</div>
<div class="sixteen wide column">
<attachment-display <attachment-display
v-for="item in attachments" v-for="item in attachments"
:item="item" :item="item"
:key="item.id" :key="item.id"
:search-params="searchParams"
/> />
</div> </div>
@ -50,18 +63,30 @@
mounted: function(){ mounted: function(){
//Mount notes on load if note ID is set //Mount notes on load if note ID is set
this.openNoteAttachments()
this.searchAttachments()
},
watch:{
$route (to, from){
//Open or close notes on route change
this.openNoteAttachments()
this.searchAttachments()
}
},
methods: {
openNoteAttachments(){
if(this.$route.params && this.$route.params.id){ if(this.$route.params && this.$route.params.id){
const inputNoteId = this.$route.params.id const inputNoteId = this.$route.params.id
this.searchParams['noteId'] = inputNoteId this.searchParams['noteId'] = inputNoteId
} }
this.searchAttachments()
}, },
methods: { openNote(){
const noteId = this.searchParams['noteId']
this.$router.push('/notes/open/'+noteId)
},
clearNote(){ clearNote(){
this.$router.push('/attachments/') this.$router.push('/attachments/')
delete this.searchParams.noteId delete this.searchParams.noteId
this.searchAttachments()
}, },
searchAttachments (){ searchAttachments (){

View File

@ -115,6 +115,18 @@
</div> </div>
<!-- found attachments -->
<div class="sixteen wide column" v-if="foundAttachments.length > 0">
<h4><i class="green folder icon"></i> Found in Files ({{ foundAttachments.length }})</h4>
<attachment-display
v-for="item in foundAttachments"
:item="item"
:key="item.id"
:search-params="{}"
/>
</div>
</div> </div>
@ -135,6 +147,7 @@
'note-title-display-card': require('@/components/NoteTitleDisplayCard.vue').default, 'note-title-display-card': require('@/components/NoteTitleDisplayCard.vue').default,
'fast-filters': require('@/components/FastFilters.vue').default, 'fast-filters': require('@/components/FastFilters.vue').default,
'search-input': require('@/components/SearchInput.vue').default, 'search-input': require('@/components/SearchInput.vue').default,
'attachment-display': require('@/components/AttachmentDisplayCard').default,
}, },
data () { data () {
return { return {
@ -176,20 +189,14 @@
lastVisibilityState: null, lastVisibilityState: null,
foundAttachments: []
} }
}, },
beforeMount(){ beforeMount(){
this.$parent.loginGateway() this.$parent.loginGateway()
//Load tinymce into the page only do it once
if(document.querySelectorAll('[data-mceload]').length == 0){
let tinyMceIncluder = document.createElement('script')
tinyMceIncluder.setAttribute('src', '/api/static/assets/tinymce/tinymce.min.js')
tinyMceIncluder.setAttribute('data-mceload','loaded')
document.head.appendChild(tinyMceIncluder)
}
this.$bus.$on('close_active_note', ({position, noteId}) => { this.$bus.$on('close_active_note', ({position, noteId}) => {
this.closeNote(position) this.closeNote(position)
this.updateSingleNote(noteId) this.updateSingleNote(noteId)
@ -220,6 +227,9 @@
this.searchTerm = sentInSearchTerm this.searchTerm = sentInSearchTerm
this.search(true, this.batchSize) this.search(true, this.batchSize)
.then( () => { .then( () => {
this.searchAttachments()
return this.fetchUserTags() return this.fetchUserTags()
}) })
}) })
@ -244,7 +254,7 @@
//Close notes when back button is pressed //Close notes when back button is pressed
window.addEventListener('hashchange', this.hashChangeAction) window.addEventListener('hashchange', this.hashChangeAction)
//update note on visibility change
document.addEventListener('visibilitychange', this.visibiltyChangeAction); document.addEventListener('visibilitychange', this.visibiltyChangeAction);
}, },
@ -475,6 +485,14 @@
} }
}) })
}, },
searchAttachments(){
axios.post('/api/attachment/textsearch', {'searchTerm':this.searchTerm})
.then(results => {
console.log('Attachment Results')
console.log(results.data)
this.foundAttachments = results.data
})
},
search(showLoading = true, notesInNextLoad = null, mergeExisting = false){ search(showLoading = true, notesInNextLoad = null, mergeExisting = false){
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -595,6 +613,7 @@
this.searchTerm = '' this.searchTerm = ''
this.searchTags = [] this.searchTags = []
this.fastFilters = {} this.fastFilters = {}
this.foundAttachments = [] //Remove all attachments
this.$bus.$emit('reset_fast_filters') this.$bus.$emit('reset_fast_filters')
//Load initial batch, then tags, then other batch //Load initial batch, then tags, then other batch

View File

@ -83,7 +83,7 @@
checkKeyup(event){ checkKeyup(event){
let element = event.target let element = event.target
let padding = 22 let padding = 0
element.style.height = 'auto'; element.style.height = 'auto';
element.style.height = (element.scrollHeight + padding) +'px'; element.style.height = (element.scrollHeight + padding) +'px';

View File

@ -11,6 +11,7 @@ export default new Vuex.Store({
nightMode: false, nightMode: false,
isUserOnMobile: false, isUserOnMobile: false,
isNoteSettingsOpen: false, //Little note settings pane isNoteSettingsOpen: false, //Little note settings pane
socket: null,
}, },
mutations: { mutations: {
setLoginToken(state, userData){ setLoginToken(state, userData){
@ -81,7 +82,14 @@ export default new Vuex.Store({
}, },
toggleNoteSettingsPane(state){ toggleNoteSettingsPane(state){
state.isNoteSettingsOpen = !state.isNoteSettingsOpen state.isNoteSettingsOpen = !state.isNoteSettingsOpen
},
setSocketIoSocket(state, socket){
//Put socket id in axios headers
axios.defaults.headers.common['socketId'] = socket
state.socket = socket
} }
}, },
getters: { getters: {
getUsername: state => { getUsername: state => {
@ -103,5 +111,8 @@ export default new Vuex.Store({
getIsNoteSettingsOpen: state => { getIsNoteSettingsOpen: state => {
return state.isNoteSettingsOpen return state.isNoteSettingsOpen
}, },
getSocket: state => {
return state.socket
},
} }
}) })

View File

@ -12,11 +12,14 @@
"body-parser": "^1.18.3", "body-parser": "^1.18.3",
"cheerio": "^1.0.0-rc.3", "cheerio": "^1.0.0-rc.3",
"express": "^4.16.4", "express": "^4.16.4",
"gm": "^1.23.1",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"multer": "^1.4.2", "multer": "^1.4.2",
"mysql2": "^1.6.5", "mysql2": "^1.6.5",
"node-tesseract-ocr": "^1.0.0",
"request": "^2.88.0", "request": "^2.88.0",
"request-promise": "^4.2.4", "request-promise": "^4.2.4",
"socket.io": "^2.3.0",
"solr-node": "^1.2.1" "solr-node": "^1.2.1"
}, },
"_moduleAliases": { "_moduleAliases": {

View File

@ -8,7 +8,7 @@ ProcessText.removeHtml = (string) => {
} }
return string return string
.replace(/&[#A-Za-z0-9]+;/g,' ') //Rip out all HTML entities .replace(/&[[#A-Za-z0-9]+A-Za-z0-9]+;/g,' ') //Rip out all HTML entities
.replace(/<[^>]+>/g, ' ') //Rip out all HTML tags .replace(/<[^>]+>/g, ' ') //Rip out all HTML tags
.replace(/\s+/g, ' ') //Remove all whitespace .replace(/\s+/g, ' ') //Remove all whitespace
.trim() .trim()
@ -25,6 +25,8 @@ ProcessText.getUrlsFromString = (string) => {
+ Empty lines are skipped + Empty lines are skipped
+ URLs are turned into links + URLs are turned into links
+ All URLs are givent the target="_blank" property + All URLs are givent the target="_blank" property
+ Lists are given extra display characters
+ If note starts as a list, skip the title
*/ */
ProcessText.deduceNoteTitle = (inString) => { ProcessText.deduceNoteTitle = (inString) => {
@ -36,7 +38,16 @@ ProcessText.deduceNoteTitle = (inString) => {
return {title, sub} return {title, sub}
} }
let lines = inString.match(/[^\r\n]+/g) //Remove inline styles that may be added by editor
inString = inString.replace(/style=".*?"/g,'')
//Match full line and closing tag or just closing tag
let lines = inString.match(/[<[a-zA-Z0-9]+>(.*?)<\/[a-zA-Z0-9]+>|<\/[a-zA-Z0-9>]+?>/g)
if(lines == null){ lines = [inString] }
//.match(/[^\r\n]+/g) //Match return or newline
// console.log(lines)
let finalLines = [] let finalLines = []
const startTags = ['<ol','<li','<ul'] const startTags = ['<ol','<li','<ul']
@ -45,6 +56,7 @@ ProcessText.deduceNoteTitle = (inString) => {
let totalLines = Math.min(lines.length, 6) let totalLines = Math.min(lines.length, 6)
let charLimit = 250 let charLimit = 250
let listStart = false let listStart = false
let noTitleJustList = false
for(let i=0; i < totalLines; i++){ for(let i=0; i < totalLines; i++){
@ -53,7 +65,10 @@ ProcessText.deduceNoteTitle = (inString) => {
continue continue
} }
const cleanLine = ProcessText.removeHtml(lines[i]).trim().replace('&nbsp','') //Various empty chars are possible
const cleanLine = ProcessText.removeHtml(lines[i])
.replace('<br>','')
.trim()
const lineStart = lines[i].trim().substring(0, 3) const lineStart = lines[i].trim().substring(0, 3)
charLimit -= cleanLine.length charLimit -= cleanLine.length
@ -69,6 +84,11 @@ ProcessText.deduceNoteTitle = (inString) => {
continue continue
} }
//Check if note starts with a list, don't include title, just show list
if(finalLines.length == 0 && startTags.includes(lineStart)){
noTitleJustList = true
}
//Empty line, may be a list open or close //Empty line, may be a list open or close
if(cleanLine.length == 0 && (startTags.includes(lineStart) || endTags.includes(lineStart) )){ if(cleanLine.length == 0 && (startTags.includes(lineStart) || endTags.includes(lineStart) )){
if(listStart == false){ if(listStart == false){
@ -86,7 +106,7 @@ ProcessText.deduceNoteTitle = (inString) => {
} }
//Skip empty lines //Skip empty lines
if(!cleanLine || cleanLine.length == 0 || cleanLine == '&nbsp;'){ if(!cleanLine || cleanLine.length == 0){
totalLines++ totalLines++
continue continue
} }
@ -126,7 +146,7 @@ ProcessText.deduceNoteTitle = (inString) => {
} }
//Pull out title if its not an empty string //Pull out title if its not an empty string
if(ProcessText.removeHtml(finalLines[0]).trim().replace('&nbsp','').length > 0){ if(ProcessText.removeHtml(finalLines[0]).trim().replace('&nbsp','').length > 0 && !noTitleJustList){
title = finalLines.shift() title = finalLines.shift()
} }

View File

@ -7,6 +7,70 @@ const express = require('express')
const app = express() const app = express()
const port = 3000 const port = 3000
var http = require('http').createServer(app);
var io = require('socket.io')(http, {
path:'/socket'
});
// Make io accessible to our router
app.use(function(req,res,next){
req.io = io;
next();
});
io.on('connection', function(socket){
// console.log('New user ', socket.id)
socket.on('join_room', roomId => {
// console.log('Join room ', roomId)
socket.join(roomId)
const usersInRoom = io.sockets.adapter.rooms[roomId]
if(usersInRoom){
// console.log('Users in room', usersInRoom.length)
io.to(roomId).emit('update_user_count', usersInRoom.length)
}
})
socket.on('leave_room', roomId => {
socket.leave(roomId)
// console.log('User Left room')
const usersInRoom = io.sockets.adapter.rooms[roomId]
if(usersInRoom){
// console.log('Users in room', usersInRoom.length)
io.to(roomId).emit('update_user_count', usersInRoom.length)
}
})
socket.on('note_diff', data => {
//Each user joins a room when they open the app.
io.in(data.id).clients((error, clients) => {
if (error) throw error;
//Go through each client in note room and send them the diff
clients.forEach(socketId => {
if(socketId != socket.id){
io.to(socketId).emit('incoming_diff', data.diff)
}
})
});
})
socket.on('disconnect', function(){
// console.log('user disconnected');
});
});
http.listen(3001, function(){
console.log('socket.io liseting on port 3001');
});
//Enable json body parsing in requests. Allows me to post data in ajax calls //Enable json body parsing in requests. Allows me to post data in ajax calls
app.use(express.json({limit: '2mb'})) app.use(express.json({limit: '2mb'}))

View File

@ -7,13 +7,47 @@ const rp = require('request-promise')
const request = require('request') const request = require('request')
const fs = require('fs') const fs = require('fs')
const gm = require('gm')
const tesseract = require("node-tesseract-ocr")
const filePath = '../staticFiles/'
// Attachment.migrateOld
Attachment.textSearch = (userId, searchTerm) => {
return new Promise((resolve, reject) => {
const front = 5
const tail = 150
const query = `
SELECT
*,
substring(
text,
IF(LOCATE(?, text) > ${tail}, LOCATE(?, text) - ${front}, 1),
${tail} + LENGTH(?) + ${front}
) as snippet
FROM attachment
WHERE user_id = ?
AND MATCH(text)
AGAINST(? IN NATURAL LANGUAGE MODE)
LIMIT 1000`
db.promise()
.query(query, [searchTerm, searchTerm, searchTerm, userId, searchTerm])
.then((rows, fields) => {
resolve(rows[0]) //Return all attachments found by query
})
.catch(console.log)
})
}
Attachment.search = (userId, noteId) => { Attachment.search = (userId, noteId) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Attachment.downloadFileFromUrl('https://i.imgur.com/5PVufWa.jpg')
let params = [userId] let params = [userId]
let query = 'SELECT * FROM attachment WHERE user_id = ? ' let query = 'SELECT * FROM attachment WHERE user_id = ? AND visible = 1 '
if(noteId && noteId > 0){ if(noteId && noteId > 0){
query += 'AND note_id = ? ' query += 'AND note_id = ? '
@ -35,7 +69,7 @@ Attachment.search = (userId, noteId) => {
Attachment.forNote = (userId, noteId) => { Attachment.forNote = (userId, noteId) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
db.promise() db.promise()
.query(`SELECT * FROM attachment WHERE user_id = ? AND note_id = ? ORDER BY last_indexed DESC;`, [userId, noteId]) .query(`SELECT * FROM attachment WHERE user_id = ? AND note_id = ? AND visible = 1 ORDER BY last_indexed DESC;`, [userId, noteId])
.then((rows, fields) => { .then((rows, fields) => {
resolve(rows[0]) //Return all attachments found by query resolve(rows[0]) //Return all attachments found by query
}) })
@ -67,29 +101,92 @@ Attachment.update = (userId, attachmentId, updatedText, noteId) => {
}) })
} }
Attachment.delete = (attachmentId) => { Attachment.delete = (userId, attachmentId, urlDelete = false) => {
console.log('Delete Attachment', attachmentId)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
db.promise() db.promise()
.query(`DELETE FROM attachment WHERE id = ?`, [attachmentId]) .query('SELECT * FROM attachment WHERE id = ? AND user_id = ? LIMIT 1', [attachmentId, userId])
.then((rows, fields) => { .then((rows, fields) => {
resolve(rows[0]) //Return all tags found by query
}) //Attachment doesn't exist, return done
if(rows[0].length == 0){
return resolve(true)
}
//Pull data we want out of
let row = rows[0][0]
let url = row.url
const noteId = row.note_id
//Do not delete link attachments, just hide them. They will be deleted if removed from note
if(row.attachment_type == 1 && !urlDelete){
db.promise()
.query(`UPDATE attachment SET visible = 0 WHERE id = ?`, [attachmentId])
.then((rows, fields) => { })
.catch(console.log) .catch(console.log)
return resolve(true)
}
//Try to delete file and thumbnail
try {
fs.unlinkSync(filePath+row.file_location)
} catch(err) { console.error('File Does not exist') }
try {
fs.unlinkSync(filePath+'thumb_'+row.file_location)
} catch(err) { console.error('Thumbnail Does not exist') }
db.promise()
.query(`DELETE FROM attachment WHERE id = ?`, [attachmentId])
.then((rows, fields) => { })
.catch(console.log)
//Normal notes are done, for links, remove the link from the note
// if(row.attachment_type != 1){
return resolve(true)
// }
//The code below will delete URL text for note
db.promise().query('SELECT text FROM note WHERE id = ? AND user_id = ?', [noteId, userId])
.then((rows, fields) => {
//Grab note text
let text = rows[0][0]['text']
//Remove URL from text, then remove A tags with empty hrefs
let newText = text.replace(url, '').replace(/<a href="">[^<]*<\/a>/g, '')
db.promise().query('UPDATE note SET text = ? WHERE id = ? AND user_id = ? LIMIT 1 ', [newText, noteId, userId])
.then((rows, fields) => {
//Only reindex if note was deleted from menu
if(reindex){
const Note = require('@models/Note')
//Reindex Note after updating text
Note.reindex(userId, noteId)
}
return resolve(true)
})
})
})
}) })
} }
Attachment.processUploadedFile = (userId, noteId, fileObject) => { Attachment.processUploadedFile = (userId, noteId, fileObject) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const rawFilename = fileObject.filename
const extension = '.'+fileObject.originalname.split('.').pop()
const goodFileName = rawFilename+extension
const fileName = fileObject.originalname //Actual name of the file, dog.jpg
//Rename random file name to one with an extension
fs.rename(filePath+rawFilename, filePath+goodFileName, (err) => {
const created = Math.round((+new Date)/1000) const created = Math.round((+new Date)/1000)
const fileLocation = fileObject.filename
const fileName = fileObject.originalname
// console.log('Adding file')
// console.log( [noteId, userId, 2, fileName, created, fileLocation] )
//Create attachment in DB with scrape text and provided data
db.promise() db.promise()
.query(` .query(`
@ -97,12 +194,58 @@ Attachment.processUploadedFile = (userId, noteId, fileObject) => {
(note_id, user_id, attachment_type, \`text\`, last_indexed, file_location) (note_id, user_id, attachment_type, \`text\`, last_indexed, file_location)
VALUES VALUES
(?, ?, ?, ?, ?, ?) (?, ?, ?, ?, ?, ?)
`, [noteId, userId, 2, fileName, created, fileLocation]) `, [noteId, userId, 2, 'Add a description to -> '+fileName, created, goodFileName])
.then((rows, fields) => { .then((rows, fields) => {
console.log('Created attachment for ',fileName)
resolve({ fileName, fileLocation }) //Return found text Attachment.generateThumbnail(goodFileName)
//If its an image, scrape text
if(true){
// https://github.com/tesseract-ocr/tesseract/wiki/ImproveQuality
//psm 3 - default, 11 - as much text as possible
const config = { lang: "eng", oem: 1, psm: 3 }
tesseract.recognize(filePath+goodFileName, config)
.then(text => {
text = text.slice(0, -1).trim()
if(text.length > 5){
console.log('Inserting text')
db.promise().query(
`UPDATE attachment SET text = ? WHERE id = ? AND user_id = ? LIMIT 1`,
[text, rows[0].insertId, userId]
).then(results => {
resolve({ fileName, goodFileName })
})
} else {
return resolve({ fileName, goodFileName })
}
})
.catch(error => {
console.log(error.message)
})
} else {
resolve({ fileName, goodFileName })
}
}) })
.catch(console.log) .catch(console.log)
})
})
}
Attachment.generateThumbnail = (fileName) => {
return new Promise((resolve, reject) => {
gm(filePath+fileName)
.resize(550) //Resize to width of 550 px
.quality(75) //compression level 0 - 100 (best)
.write(filePath + 'thumb_'+fileName, function (err) {
resolve(fileName)
})
}) })
} }
@ -121,10 +264,30 @@ Attachment.scanTextForWebsites = (userId, noteId, noteText) => {
const urlPattern = /(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#/%=~_|$?!:,.]*\)|[A-Z0-9+&@#/%=~_|$])/igm const urlPattern = /(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#/%=~_|$?!:,.]*\)|[A-Z0-9+&@#/%=~_|$])/igm
let allUrls = noteText.match(urlPattern) let allUrls = noteText.match(urlPattern)
//Remove all duplicates if(allUrls == null){
let foundUrls = [...new Set(allUrls)] allUrls = []
}
//Go through each attachment, check for existing URLs //Every URL needs HTTPS
let foundUrls = []
allUrls.forEach( (item, index) => {
//Every URL should have HTTPS
if(item.indexOf('https://') == -1 && item.indexOf('http://') == -1){
allUrls[index] = 'https://'+item
}
//URLs should all have HTTPS!!!
if(item.indexOf('http://') >= 0){
allUrls[index] = item.replace('http://','https://')
}
})
//Remove all duplicates
foundUrls = [...new Set(allUrls)]
//Go through each saved URL, remove new URLs from saved URLs
//If a URL is not found, delete it
attachments.forEach(attachment => { attachments.forEach(attachment => {
//URL already scraped, push text and continue //URL already scraped, push text and continue
let urlIndex = foundUrls.indexOf( attachment.url ) let urlIndex = foundUrls.indexOf( attachment.url )
@ -134,7 +297,7 @@ Attachment.scanTextForWebsites = (userId, noteId, noteText) => {
foundUrls.splice(urlIndex, 1) //Remove existing from set of found foundUrls.splice(urlIndex, 1) //Remove existing from set of found
} else { } else {
//If existing attachment is not found in note, remove it //If existing attachment is not found in note, remove it
Attachment.delete(attachment.id) Attachment.delete(userId, attachment.id, true)
} }
}) })
@ -183,18 +346,22 @@ Attachment.scrapeUrlsCreateAttachments = (userId, noteId, foundUrls) => {
}) })
} }
Attachment.downloadFileFromUrl = (url) => { Attachment.downloadFileFromUrl = (url) => {
//File Path
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if(url == null){
resolve(null)
}
const random = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15) const random = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15)
const filePath = '../staticFiles/' const extension = '.'+url.split('.').pop() //This is throwing an error
let fileName = filePath + random + '_img' let fileName = random+'_scrape'+extension
const thumbPath = 'thumb_'+fileName
console.log('Scraping image url')
console.log(url)
console.log('Getting ready to scrape ', url) console.log('Getting ready to scrape ', url)
@ -207,15 +374,24 @@ Attachment.downloadFileFromUrl = (url) => {
console.log(res.statusCode) console.log(res.statusCode)
console.log(res.headers['content-type']) console.log(res.headers['content-type'])
}) })
.pipe(fs.createWriteStream(fileName)) .pipe(fs.createWriteStream(filePath+thumbPath))
.on('close', () => { .on('close', () => {
//resize image if its real big
gm(filePath+thumbPath)
.resize(550) //Resize to width of 550 px
.quality(75) //compression level 0 - 100 (best)
.write(filePath+thumbPath, function (err) {
if(err){ console.log(err) }
})
console.log('Saved Image') console.log('Saved Image')
resolve(random + '_img') resolve(fileName)
}) })
}) })
} }
Attachment.processUrl = (userId, noteId, url) => { Attachment.processUrl = (userId, noteId, url) => {
const scrapeTime = 20*1000; const scrapeTime = 20*1000;
@ -231,8 +407,6 @@ Attachment.processUrl = (userId, noteId, url) => {
var removeWhitespace = /\s+/g var removeWhitespace = /\s+/g
// console.log('Scraping ', website)
const options = { const options = {
uri: url, uri: url,
simple: true, simple: true,
@ -247,8 +421,23 @@ Attachment.processUrl = (userId, noteId, url) => {
let requestTimeout = null let requestTimeout = null
let thumbnail = null let thumbnail = null
let request = null
let created = Math.round((+new Date)/1000)
let insertedId = null
let request = rp(options) //Create a shell attachment for each URL, put in processing state
db.promise()
.query(`INSERT INTO attachment
(note_id, user_id, attachment_type, text, url, last_indexed, file_location)
VALUES (?, ?, ?, ?, ?, ?, ?)`,
[noteId, userId, 1, 'Processing...', url, created, null])
.then((rows, fields) => {
//Set two bigger variables then return request for processing
request = rp(options)
insertedId = rows[0].insertId
return request
})
.then($ => { .then($ => {
clearTimeout(requestTimeout) clearTimeout(requestTimeout)
@ -258,16 +447,12 @@ Attachment.processUrl = (userId, noteId, url) => {
let pageTitle = $('title').text().replace(removeWhitespace, " ") let pageTitle = $('title').text().replace(removeWhitespace, " ")
desiredSearchText += pageTitle + "\n" desiredSearchText += pageTitle + "\n"
let header = $('h1').text().replace(removeWhitespace, " ") // let header = $('h1').text().replace(removeWhitespace, " ")
desiredSearchText += header + "\n" // desiredSearchText += header + "\n"
//Scrape metadata for page image
let metadata = $('meta[property="og:image"]') let metadata = $('meta[property="og:image"]')
//'meta[property="og:image"]' .conten()
console.log('Scrape metadata')
// console.log(metadata)
if(metadata && metadata[0] && metadata[0].attribs){ if(metadata && metadata[0] && metadata[0].attribs){
console.log('Found metadata image')
console.log(metadata[0].attribs.content)
thumbnail = metadata[0].attribs.content thumbnail = metadata[0].attribs.content
} }
@ -310,32 +495,51 @@ Attachment.processUrl = (userId, noteId, url) => {
}); });
let finalWords = [] let finalWords = []
for(let i=0; i<15; i++){ for(let i=0; i<5; i++){
if(sortable[i] && sortable[i][0]){ if(sortable[i] && sortable[i][0]){
finalWords.push(sortable[i][0]) finalWords.push(sortable[i][0])
} }
} }
desiredSearchText += finalWords.join(', ') if(finalWords.length > 0){
console.log('TexT Scraped') desiredSearchText += 'Keywords: ' + finalWords.join(', ')
console.log(desiredSearchText) }
const created = Math.round((+new Date)/1000)
// console.log('TexT Scraped')
// console.log(desiredSearchText)
created = Math.round((+new Date)/1000)
//Scrape URL for thumbnail - take filename and save in attachment //Scrape URL for thumbnail - take filename and save in attachment
Attachment.downloadFileFromUrl(thumbnail) Attachment.downloadFileFromUrl(thumbnail)
.then(thumbnailFilename => { .then(thumbnailFilename => {
//Create attachment in DB with scrape text and provided data //Update text and thumbnail filename
created = Math.round((+new Date)/1000)
db.promise() db.promise()
.query(`INSERT INTO attachment .query(`UPDATE attachment SET
(note_id, user_id, attachment_type, text, url, last_indexed, file_location) text = ?,
VALUES (?, ?, ?, ?, ?, ?, ?)`, [noteId, userId, 1, desiredSearchText, url, created, thumbnailFilename]) last_indexed = ?,
file_location = ?
WHERE id = ?
`, [desiredSearchText, created, thumbnailFilename, insertedId])
.then((rows, fields) => { .then((rows, fields) => {
resolve(desiredSearchText) //Return found text resolve(desiredSearchText) //Return found text
}) })
.catch(console.log) .catch(console.log)
//Create attachment in DB with scrape text and provided data
// db.promise()
// .query(`INSERT INTO attachment
// (note_id, user_id, attachment_type, text, url, last_indexed, file_location)
// VALUES (?, ?, ?, ?, ?, ?, ?)`, [noteId, userId, 1, desiredSearchText, url, created, thumbnailFilename])
// .then((rows, fields) => {
// resolve(desiredSearchText) //Return found text
// })
// .catch(console.log)
}) })
}) })
@ -349,19 +553,30 @@ Attachment.processUrl = (userId, noteId, url) => {
console.log('Cancel the request, its taking to long.') console.log('Cancel the request, its taking to long.')
request.cancel() request.cancel()
desiredSearchText = url desiredSearchText = 'No Description for -> '+url
const created = Math.round((+new Date)/1000)
//Create attachment in DB with scrape text and provided data created = Math.round((+new Date)/1000)
db.promise() db.promise()
.query(`INSERT INTO attachment .query(`UPDATE attachment SET
(note_id, user_id, attachment_type, text, url, last_indexed) text = ?,
VALUES (?, ?, ?, ?, ?, ?)`, [noteId, userId, 1, desiredSearchText, url, created]) last_indexed = ?,
WHERE id = ?
`, [desiredSearchText, created, insertedId])
.then((rows, fields) => { .then((rows, fields) => {
resolve(desiredSearchText) //Return found text resolve(desiredSearchText) //Return found text
}) })
.catch(console.log) .catch(console.log)
}, (scrapeTime)) //Create attachment in DB with scrape text and provided data
// db.promise()
// .query(`INSERT INTO attachment
// (note_id, user_id, attachment_type, text, url, last_indexed)
// VALUES (?, ?, ?, ?, ?, ?)`, [noteId, userId, 1, desiredSearchText, url, created])
// .then((rows, fields) => {
// resolve(desiredSearchText) //Return found text
// })
// .catch(console.log)
}, scrapeTime )
}) })
} }

View File

@ -12,6 +12,37 @@ const fs = require('fs')
let Note = module.exports = {} let Note = module.exports = {}
const gm = require('gm')
Note.fixAttachmentThumbnails = () => {
const filePath = '../staticFiles/'
db.promise()
.query(`SELECT * FROM attachment WHERE file_location NOT LIKE "%.%"`)
.then( (rows, fields) => {
rows[0].forEach(line => {
const rawFilename = line['file_location']
const goodFileName = rawFilename+'.jpg'
//Rename file to have jpg extension, create thumbnail, update database
fs.rename(filePath+rawFilename, filePath+goodFileName, (err) => {
db.promise()
.query(`UPDATE attachment SET file_location = ? WHERE id = ?`,[goodFileName, line['id'] ])
.then( (rows, fields) => {
gm(filePath+goodFileName)
.resize(550) //Resize to width of 550 px
.quality(75) //compression level 0 - 100 (best)
.write(filePath + 'thumb_'+goodFileName, function (err) {
console.log('Done for -> ', goodFileName)
})
})
})
})
})
}
Note.stressTest = () => { Note.stressTest = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -81,18 +112,16 @@ Note.reindex = (userId, noteId) => {
Note.get(userId, noteId) Note.get(userId, noteId)
.then(note => { .then(note => {
const noteText = note.text const noteText = note.text
//Process note text and attachment data
Attachment.scanTextForWebsites(userId, noteId, noteText)
.then( allNoteAttachmentText => {
// //
// Update Solr index // Update Solr index
// //
Tags.string(userId, noteId) Tags.string(userId, noteId)
.then(tagString => { .then(tagString => {
const fullText = ProcessText.removeHtml(noteText) +' '+ tagString +' '+ ProcessText.removeHtml(allNoteAttachmentText) const fullText = ProcessText.removeHtml(noteText) +' '+ tagString
db.promise() db.promise()
.query(` .query(`
@ -108,7 +137,6 @@ Note.reindex = (userId, noteId) => {
.catch(console.log) .catch(console.log)
}) })
})
}) })
}) })
@ -133,6 +161,9 @@ Note.update = (userId, noteId, noteText, color, pinned, archived) => {
//Async solr note reindex //Async solr note reindex
Note.reindex(userId, noteId) Note.reindex(userId, noteId)
//Async attachment reindex
Attachment.scanTextForWebsites(userId, noteId, noteText)
//Send back updated response //Send back updated response
resolve(rows[0]) resolve(rows[0])
}) })
@ -147,29 +178,15 @@ Note.update = (userId, noteId, noteText, color, pinned, archived) => {
Note.delete = (userId, noteId) => { Note.delete = (userId, noteId) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
//
// Delete, note, text index, tags
// Leave the attachments, they can be deleted on their own
//
db.promise().query('DELETE FROM note WHERE note.id = ? AND note.user_id = ?', [noteId,userId]) db.promise().query('DELETE FROM note WHERE note.id = ? AND note.user_id = ?', [noteId,userId])
.then((rows, fields) => { .then((rows, fields) => {
return db.promise().query('DELETE FROM note_text_index WHERE note_text_index.note_id = ? AND note_text_index.user_id = ?', [noteId,userId]) return db.promise().query('DELETE FROM note_text_index WHERE note_text_index.note_id = ? AND note_text_index.user_id = ?', [noteId,userId])
}) })
.then((rows, fields) => {
//Select all attachments with files
return db.promise().query('SELECT file_location FROM attachment WHERE attachment.note_id = ? AND attachment.user_id = ?', [noteId,userId])
})
.then((attachmentRows, fields) => {
//Go through each selected attachment and delete the files
attachmentRows[0].forEach( location => {
const fileName = location['file_location']
if(fileName != null && fileName.length > 1){
fs.unlink('../staticFiles/'+fileName ,function(err){ //Async, just rip through them.
if(err) return console.log(err);
// console.log('file deleted successfully => ', fileName);
})
}
})
return db.promise().query('DELETE FROM attachment WHERE attachment.note_id = ? AND attachment.user_id = ?', [noteId,userId])
})
.then((rows, fields) => { .then((rows, fields) => {
return db.promise().query('DELETE FROM note_tag WHERE note_tag.note_id = ? AND note_tag.user_id = ?', [noteId,userId]) return db.promise().query('DELETE FROM note_tag WHERE note_tag.note_id = ? AND note_tag.user_id = ?', [noteId,userId])
}) })
@ -449,6 +466,7 @@ Note.search = (userId, searchQuery, searchTags, fastFilters) => {
//Deduce note title //Deduce note title
const textData = ProcessText.deduceNoteTitle(note.text) const textData = ProcessText.deduceNoteTitle(note.text)
// console.log(textData)
// console.log(textData) // console.log(textData)

View File

@ -22,6 +22,11 @@ router.post('/search', function (req, res) {
.then( data => res.send(data) ) .then( data => res.send(data) )
}) })
router.post('/textsearch', function (req, res) {
Attachment.textSearch(userId, req.body.searchTerm)
.then( data => res.send(data) )
})
router.post('/get', function (req, res) { router.post('/get', function (req, res) {
Attachment.forNote(userId, req.body.noteId) Attachment.forNote(userId, req.body.noteId)
.then( data => res.send(data) ) .then( data => res.send(data) )
@ -35,6 +40,11 @@ router.post('/update', function (req, res) {
}) })
}) })
router.post('/delete', function (req, res) {
Attachment.delete(userId, req.body.attachmentId)
.then( data => res.send(data) )
})
router.post('/upload', upload.single('file'), function (req, res, next) { router.post('/upload', upload.single('file'), function (req, res, next) {
//Create attachment with file information and node id //Create attachment with file information and node id

View File

@ -2,20 +2,30 @@ var express = require('express')
var router = express.Router() var router = express.Router()
let Notes = require('@models/Note'); let Notes = require('@models/Note');
let userId = null let userId = null
let socket = null
// middleware that is specific to this router // middleware that is specific to this router
router.use(function setUserId (req, res, next) { router.use(function setUserId (req, res, next) {
if(userId = req.headers.userId){ if(req.headers.userId){
userId = req.headers.userId userId = req.headers.userId
} }
if(req.headers.socket){
// socket = req.
}
next() next()
}) })
router.post('/get', function (req, res) { router.post('/get', function (req, res) {
req.io.emit('welcome_homie', 'Welcome, dont poop from excitement')
Notes.get(userId, req.body.noteId) Notes.get(userId, req.body.noteId)
.then( data => res.send(data) ) .then( data => {
//Join room when user opens note
// req.io.join('note_room')
res.send(data)
})
}) })
router.post('/delete', function (req, res) { router.post('/delete', function (req, res) {
@ -35,11 +45,12 @@ router.post('/update', function (req, res) {
router.post('/search', function (req, res) { router.post('/search', function (req, res) {
Notes.search(userId, req.body.searchQuery, req.body.searchTags, req.body.fastFilters) Notes.search(userId, req.body.searchQuery, req.body.searchTags, req.body.fastFilters)
.then( notesAndTags => res.send(notesAndTags)) .then( notesAndTags => {
res.send(notesAndTags)
})
}) })
router.post('/difftext', function (req, res) { router.post('/difftext', function (req, res) {
Notes.getDiffText(userId, req.body.noteId, req.body.text, req.body.updated) Notes.getDiffText(userId, req.body.noteId, req.body.text, req.body.updated)
.then( fullDiffText => { .then( fullDiffText => {
//Response should be full diff text //Response should be full diff text
@ -50,6 +61,9 @@ router.post('/difftext', function (req, res) {
//Reindex all notes. Not a very good function, not public //Reindex all notes. Not a very good function, not public
router.get('/reindex5yu43prchuj903mrc', function (req, res) { router.get('/reindex5yu43prchuj903mrc', function (req, res) {
Notes.fixAttachmentThumbnails()
res.send('A whole mess is going on in the background')
// Notes.stressTest().then( i => { // Notes.stressTest().then( i => {
// // Notes.reindexAll().then( result => res.send('Welcome to reindex...oh god')) // // Notes.reindexAll().then( result => res.send('Welcome to reindex...oh god'))
// }) // })

View File

@ -1,91 +0,0 @@
/**
* 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)}}}();

View File

@ -1,3 +0,0 @@
This is where language files should be placed.
Please DO NOT translate these directly use this service: https://www.transifex.com/projects/p/tinymce/

View File

@ -1,504 +0,0 @@
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!

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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))})}()}();

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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)})}()}();

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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 m(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"),y=function(t){return t.getParam("autolink_pattern",/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i)},k=function(t){return t.getParam("default_link_target",!1)},r=function(t,e,n){var i,o,r,f,a,s,d,c,l,u,g=y(t),h=k(t);if("A"!==t.selection.getNode().tagName){if((i=t.selection.getRng(!0).cloneRange()).startOffset<5){if(!(c=i.endContainer.previousSibling)){if(!i.endContainer.firstChild||!i.endContainer.firstChild.nextSibling)return;c=i.endContainer.firstChild.nextSibling}if(l=c.length,C(i,c,l),m(i,c,l),i.endOffset<5)return;o=i.endOffset,f=c}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),m(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),m(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),m(i,f,r)):(C(i,f,o),m(i,f,r),o+=1),"."===(s=i.toString()).charAt(s.length-1)&&m(i,f,r-1),(d=(s=i.toString().trim()).match(g))&&("www."===d[1]?d[1]="http://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)})}()}();

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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)}})}()}();

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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|&nbsp;|[ \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);

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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(/&nbsp;|\u00a0/gi," "),o(/&quot;/gi,'"'),o(/&lt;/gi,"<"),o(/&gt;/gi,">"),o(/&amp;/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>&nbsp;'),o(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span>&nbsp;'),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))})})}()}();

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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),{}})}()}();

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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);

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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);

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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)})}()}();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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)})}()}();

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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)})}()}();

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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")},o=function(e,t){e.settings.inline_styles=t},r=function(e){!function(e){o(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("init",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 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){r(e)})}()}();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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("&nbsp;",e)+"</span>":o("&nbsp;",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)})}()}();

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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)})}()}();

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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)})}()}();

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!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)})}()}();

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env"),i=function(n){n.addCommand("mcePrint",function(){t.browser.isIE()?n.getDoc().execCommand("print",!1,null):n.getWin().print()})},e=function(n){n.ui.registry.addButton("print",{icon:"print",tooltip:"Print",onAction:function(){return n.execCommand("mcePrint")}}),n.ui.registry.addMenuItem("print",{text:"Print...",icon:"print",onAction:function(){return n.execCommand("mcePrint")}})};!function o(){n.add("print",function(n){i(n),e(n),n.addShortcut("Meta+P","","mcePrint")})}()}();

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!function(){"use strict";function t(n,e){n.notificationManager.open({text:e,type:"error"})}function e(t){return function(n){function e(){n.setDisabled(a(t)&&!t.isDirty())}return t.on("NodeChange dirty",e),function(){return t.off("NodeChange dirty",e)}}}var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),i=tinymce.util.Tools.resolve("tinymce.util.Tools"),a=function(n){return n.getParam("save_enablewhendirty",!0)},c=function(n){return!!n.getParam("save_onsavecallback")},r=function(n){return!!n.getParam("save_oncancelcallback")},u=function(n){var e;if(e=o.DOM.getParent(n.id,"form"),!a(n)||n.isDirty()){if(n.save(),c(n))return n.execCallback("save_onsavecallback",n),void n.nodeChanged();e?(n.setDirty(!1),e.onsubmit&&!e.onsubmit()||("function"==typeof e.submit?e.submit():t(n,"Error: Form submit field collision.")),n.nodeChanged()):t(n,"Error: No form element found.")}},l=function(n){var e=i.trim(n.startContent);r(n)?n.execCallback("save_oncancelcallback",n):n.resetContent(e)},s=function(n){n.addCommand("mceSave",function(){u(n)}),n.addCommand("mceCancel",function(){l(n)})},d=function(n){n.ui.registry.addButton("save",{icon:"save",tooltip:"Save",disabled:!0,onAction:function(){return n.execCommand("mceSave")},onSetup:e(n)}),n.ui.registry.addButton("cancel",{icon:"cancel",tooltip:"Cancel",disabled:!0,onAction:function(){return n.execCommand("mceCancel")},onSetup:e(n)}),n.addShortcut("Meta+S","","mceSave")};!function m(){n.add("save",function(n){d(n),s(n)})}()}();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!function(c){"use strict";function t(e){e.keyCode!==d.TAB||e.ctrlKey||e.altKey||e.metaKey||e.preventDefault()}var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),s=tinymce.util.Tools.resolve("tinymce.EditorManager"),a=tinymce.util.Tools.resolve("tinymce.Env"),y=tinymce.util.Tools.resolve("tinymce.util.Delay"),f=tinymce.util.Tools.resolve("tinymce.util.Tools"),d=tinymce.util.Tools.resolve("tinymce.util.VK"),m=function(e){return e.getParam("tab_focus",function(e){return e.getParam("tabfocus_elements",":prev,:next")}(e))},v=n.DOM,i=function(r){function e(n){var i,o,e,l;if(!(n.keyCode!==d.TAB||n.ctrlKey||n.altKey||n.metaKey||n.isDefaultPrevented())&&(1===(e=f.explode(m(r))).length&&(e[1]=e[0],e[0]=":prev"),o=n.shiftKey?":prev"===e[0]?u(-1):v.get(e[0]):":next"===e[1]?u(1):v.get(e[1]))){var t=s.get(o.id||o.name);o.id&&t?t.focus():y.setTimeout(function(){a.webkit||c.window.focus(),o.focus()},10),n.preventDefault()}function u(e){function t(e){return/INPUT|TEXTAREA|BUTTON/.test(e.tagName)&&s.get(n.id)&&-1!==e.tabIndex&&function t(e){return"BODY"===e.nodeName||"hidden"!==e.type&&"none"!==e.style.display&&"hidden"!==e.style.visibility&&t(e.parentNode)}(e)}if(o=v.select(":input:enabled,*[tabindex]:not(iframe)"),f.each(o,function(e,t){if(e.id===r.id)return i=t,!1}),0<e){for(l=i+1;l<o.length;l++)if(t(o[l]))return o[l]}else for(l=i-1;0<=l;l--)if(t(o[l]))return o[l];return null}}r.on("init",function(){r.inline&&v.setAttrib(r.getBody(),"tabIndex",null),r.on("keyup",t),a.gecko?r.on("keypress keydown",e):r.on("keydown",e)})};!function o(){e.add("tabfocus",function(e){i(e)})}()}(window);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!function(o){"use strict";var i=tinymce.util.Tools.resolve("tinymce.PluginManager");!function n(){i.add("textcolor",function(){o.console.warn("Text color plugin is now built in to the core editor, please remove it from your editor configuration")})}()}(window);

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!function(){"use strict";function e(n){return function(t){function e(){return t.setDisabled(n.readonly||!v.hasHeaders(n))}return e(),n.on("LoadContent SetContent change",e),function(){return n.on("LoadContent SetContent change",e)}}}var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),l=tinymce.util.Tools.resolve("tinymce.util.I18n"),i=tinymce.util.Tools.resolve("tinymce.util.Tools"),c=function(t){return t.getParam("toc_class","mce-toc")},d=function(t){var e=t.getParam("toc_header","h2");return/^h[1-6]$/.test(e)?e:"h2"},a=function(t){var e=parseInt(t.getParam("toc_depth","3"),10);return 1<=e&&e<=9?e:3},s=function(e){var n=0;return function(){var t=(new Date).getTime().toString(32);return e+t+(n++).toString(32)}}("mcetoc_"),f=function f(t){var e,n=[];for(e=1;e<=t;e++)n.push("h"+e);return n.join(",")},m=function(n){var o=c(n),t=d(n),e=f(a(n)),r=n.$(e);return r.length&&/^h[1-9]$/i.test(t)&&(r=r.filter(function(t,e){return!n.dom.hasClass(e.parentNode,o)})),i.map(r,function(t){return{id:t.id?t.id:s(),level:parseInt(t.nodeName.replace(/^H/i,""),10),title:n.$.text(t),element:t}})},o=function(t){var e,n,o,r,i="",c=m(t),a=function(t){var e,n=9;for(e=0;e<t.length;e++)if(t[e].level<n&&(n=t[e].level),1===n)return n;return n}(c)-1;if(!c.length)return"";for(i+=function(t,e){var n="</"+t+">";return"<"+t+' contenteditable="true">'+u.DOM.encode(e)+n}(d(t),l.translate("Table of Contents")),e=0;e<c.length;e++){if((o=c[e]).element.id=o.id,r=c[e+1]&&c[e+1].level,a===o.level)i+="<li>";else for(n=a;n<o.level;n++)i+="<ul><li>";if(i+='<a href="#'+o.id+'">'+o.title+"</a>",r!==o.level&&r)for(n=o.level;r<n;n--)i+="</li></ul><li>";else i+="</li>",r||(i+="</ul>");a=o.level}return i},r=function(t){var e=c(t),n=t.$("."+e);n.length&&t.undoManager.transact(function(){n.html(o(t))})},v={hasHeaders:function(t){return 0<m(t).length},insertToc:function(t){var e=c(t),n=t.$("."+e);!function(t,e){return!e.length||0<t.dom.getParents(e[0],".mce-offscreen-selection").length}(t,n)?r(t):t.insertContent(function(t){var e=o(t);return'<div class="'+t.dom.encode(c(t))+'" contenteditable="false">'+e+"</div>"}(t))},updateToc:r},n=function(t){t.addCommand("mceInsertToc",function(){v.insertToc(t)}),t.addCommand("mceUpdateToc",function(){v.updateToc(t)})},g=function(t){var n=t.$,o=c(t);t.on("PreProcess",function(t){var e=n("."+o,t.node);e.length&&(e.removeAttr("contentEditable"),e.find("[contenteditable]").removeAttr("contentEditable"))}),t.on("SetContent",function(){var t=n("."+o);t.length&&(t.attr("contentEditable",!1),t.children(":first-child").attr("contentEditable",!0))})},h=function(t){t.ui.registry.addButton("toc",{icon:"toc",tooltip:"Table of contents",onAction:function(){return t.execCommand("mceInsertToc")},onSetup:e(t)}),t.ui.registry.addButton("tocupdate",{icon:"reload",tooltip:"Update",onAction:function(){return t.execCommand("mceUpdateToc")}}),t.ui.registry.addMenuItem("toc",{icon:"toc",text:"Table of contents",onAction:function(){return t.execCommand("mceInsertToc")},onSetup:e(t)}),t.ui.registry.addContextToolbar("toc",{items:"tocupdate",predicate:function(e){return function(t){return t&&e.dom.is(t,"."+c(e))&&e.getBody().contains(t)}}(t),scope:"node",position:"node"})};!function p(){t.add("toc",function(t){n(t),h(t),g(t)})}()}();

View File

@ -1,9 +0,0 @@
/**
* 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.1.1 (2019-10-28)
*/
!function(){"use strict";function n(n,e){return function(o){o.setActive(e.get());function t(t){return o.setActive(t.state)}return n.on("VisualBlocks",t),function(){return n.off("VisualBlocks",t)}}}var e=function(t){function o(){return n}var n=t;return{get:o,set:function(t){n=t},clone:function(){return e(o())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(t,o){t.fire("VisualBlocks",{state:o})},u=function(t,o,n){t.dom.toggleClass(t.getBody(),"mce-visualblocks"),n.set(!n.get()),i(t,n.get())},c=function(t,o,n){t.addCommand("mceVisualBlocks",function(){u(t,o,n)})},s=function(t){return t.getParam("visualblocks_default_state",!1,"boolean")},l=function(o,t,n){o.on("PreviewFormats AfterPreviewFormats",function(t){n.get()&&o.dom.toggleClass(o.getBody(),"mce-visualblocks","afterpreviewformats"===t.type)}),o.on("init",function(){s(o)&&u(o,t,n)}),o.on("remove",function(){o.dom.removeClass(o.getBody(),"mce-visualblocks")})},r=function(t,o){t.ui.registry.addToggleButton("visualblocks",{icon:"visualblocks",tooltip:"Show blocks",onAction:function(){return t.execCommand("mceVisualBlocks")},onSetup:n(t,o)}),t.ui.registry.addToggleMenuItem("visualblocks",{text:"Show blocks",onAction:function(){return t.execCommand("mceVisualBlocks")},onSetup:n(t,o)})};!function o(){t.add("visualblocks",function(t,o){var n=e(!1);c(t,o,n),r(t,n),l(t,o,n)})}()}();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +0,0 @@
/**
* 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/
*/
body{background-color:#2f3742;color:#dfe0e4;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif;line-height:1.4;margin:1rem}a{color:#4099ff}table{border-collapse:collapse}table td,table th{border:1px solid #6d737b;padding:.4rem}figure{display:table;margin:1rem auto}figure figcaption{color:#8a8f97;display:block;margin-top:.25rem;text-align:center}hr{border-color:#6d737b;border-style:solid;border-width:1px 0 0 0}code{background-color:#6d737b;border-radius:3px;padding:.1rem .2rem}td[data-mce-selected],th[data-mce-selected]{color:#333}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #6d737b;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #6d737b;margin-right:1.5rem;padding-right:1rem}

View File

@ -1,7 +0,0 @@
/**
* 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/
*/
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif;line-height:1.4;margin:1rem}table{border-collapse:collapse}table td,table th{border:1px solid #ccc;padding:.4rem}figure{display:table;margin:1rem auto}figure figcaption{color:#999;display:block;margin-top:.25rem;text-align:center}hr{border-color:#ccc;border-style:solid;border-width:1px 0 0 0}code{background-color:#e8e8e8;border-radius:3px;padding:.1rem .2rem}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #ccc;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #ccc;margin-right:1.5rem;padding-right:1rem}

View File

@ -1,7 +0,0 @@
/**
* 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/
*/
@media screen{html{background:#f4f4f4}}body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif}@media screen{body{background-color:#fff;box-shadow:0 0 4px rgba(0,0,0,.15);box-sizing:border-box;margin:1rem auto 0;max-width:820px;min-height:calc(100vh - 1rem);padding:4rem 6rem 6rem 6rem}}table{border-collapse:collapse}table td,table th{border:1px solid #ccc;padding:.4rem}figure figcaption{color:#999;margin-top:.25rem;text-align:center}hr{border-color:#ccc;border-style:solid;border-width:1px 0 0 0}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #ccc;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #ccc;margin-right:1.5rem;padding-right:1rem}

View File

@ -1,7 +0,0 @@
/**
* 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/
*/
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif;line-height:1.4;margin:1rem auto;max-width:900px}table{border-collapse:collapse}table td,table th{border:1px solid #ccc;padding:.4rem}figure{display:table;margin:1rem auto}figure figcaption{color:#999;display:block;margin-top:.25rem;text-align:center}hr{border-color:#ccc;border-style:solid;border-width:1px 0 0 0}code{background-color:#e8e8e8;border-radius:3px;padding:.1rem .2rem}.mce-content-body:not([dir=rtl]) blockquote{border-left:2px solid #ccc;margin-left:1.5rem;padding-left:1rem}.mce-content-body[dir=rtl] blockquote{border-right:2px solid #ccc;margin-right:1.5rem;padding-right:1rem}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +0,0 @@
/**
* 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/
*/
.tinymce-mobile-unfocused-selections .tinymce-mobile-unfocused-selection{background-color:green;display:inline-block;opacity:.5;position:absolute}body{-webkit-text-size-adjust:none}body img{max-width:96vw}body table img{max-width:95%}body{font-family:sans-serif}table{border-collapse:collapse}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +0,0 @@
/**
* 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/
*/
.tinymce-mobile-unfocused-selections .tinymce-mobile-unfocused-selection{background-color:green;display:inline-block;opacity:.5;position:absolute}body{-webkit-text-size-adjust:none}body img{max-width:96vw}body table img{max-width:95%}body{font-family:sans-serif}table{border-collapse:collapse}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long