mirror of
https://github.com/documize/community.git
synced 2025-07-24 15:49:44 +02:00
markdown links support, 404 ember page added
This commit is contained in:
parent
7c2051cc7a
commit
991b1a2740
14 changed files with 207 additions and 146 deletions
|
@ -1,49 +1,49 @@
|
|||
{
|
||||
"predef": [
|
||||
"server",
|
||||
"document",
|
||||
"window",
|
||||
"-Promise",
|
||||
"moment",
|
||||
"$",
|
||||
"_",
|
||||
"is",
|
||||
"Mousetrap",
|
||||
"CodeMirror",
|
||||
"Intercom",
|
||||
"Materialize",
|
||||
"tinymce",
|
||||
"Tether",
|
||||
"Tooltip",
|
||||
"Drop",
|
||||
"Dropzone",
|
||||
"dragula",
|
||||
"datetimepicker",
|
||||
"Waypoint"
|
||||
],
|
||||
"browser": true,
|
||||
"boss": true,
|
||||
"curly": true,
|
||||
"debug": false,
|
||||
"devel": true,
|
||||
"eqeqeq": true,
|
||||
"evil": true,
|
||||
"forin": false,
|
||||
"immed": false,
|
||||
"laxbreak": false,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": false,
|
||||
"nonew": false,
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"plusplus": false,
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"sub": true,
|
||||
"strict": false,
|
||||
"white": false,
|
||||
"eqnull": true,
|
||||
"esnext": true,
|
||||
"unused": true
|
||||
"predef": [
|
||||
"server",
|
||||
"document",
|
||||
"window",
|
||||
"-Promise",
|
||||
"moment",
|
||||
"$",
|
||||
"_",
|
||||
"is",
|
||||
"Mousetrap",
|
||||
"CodeMirror",
|
||||
"Intercom",
|
||||
"Materialize",
|
||||
"tinymce",
|
||||
"Tether",
|
||||
"Tooltip",
|
||||
"Drop",
|
||||
"Dropzone",
|
||||
"dragula",
|
||||
"datetimepicker",
|
||||
"Waypoint"
|
||||
],
|
||||
"browser": true,
|
||||
"boss": true,
|
||||
"curly": true,
|
||||
"debug": false,
|
||||
"devel": true,
|
||||
"eqeqeq": true,
|
||||
"evil": true,
|
||||
"forin": false,
|
||||
"immed": false,
|
||||
"laxbreak": false,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": false,
|
||||
"nonew": false,
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"plusplus": false,
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"sub": true,
|
||||
"strict": false,
|
||||
"white": false,
|
||||
"eqnull": true,
|
||||
"esnext": true,
|
||||
"unused": true
|
||||
}
|
||||
|
|
|
@ -32,21 +32,20 @@ export default Ember.Component.extend(TooltipMixin, {
|
|||
{ label: 'Search', selected: false }
|
||||
],
|
||||
|
||||
showSections: Ember.computed('tabs.@each.selected', function() {
|
||||
showSections: Ember.computed('tabs.@each.selected', function () {
|
||||
return this.get('tabs').findBy('label', 'Section').selected;
|
||||
}),
|
||||
showAttachments: Ember.computed('tabs.@each.selected', function() {
|
||||
showAttachments: Ember.computed('tabs.@each.selected', function () {
|
||||
return this.get('tabs').findBy('label', 'Attachment').selected;
|
||||
}),
|
||||
showSearch: Ember.computed('tabs.@each.selected', function() {
|
||||
showSearch: Ember.computed('tabs.@each.selected', function () {
|
||||
return this.get('tabs').findBy('label', 'Search').selected;
|
||||
}),
|
||||
hasMatches: Ember.computed('matches', function() {
|
||||
hasMatches: Ember.computed('matches', function () {
|
||||
let m = this.get('matches');
|
||||
return m.documents.length || m.pages.length || m.attachments.length;
|
||||
}),
|
||||
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
let self = this;
|
||||
|
@ -64,6 +63,7 @@ export default Ember.Component.extend(TooltipMixin, {
|
|||
|
||||
didRender() {
|
||||
this.addTooltip(document.getElementById("content-linker-button"));
|
||||
this.addTooltip(document.getElementById("content-counter-button"));
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
|
|
|
@ -1,17 +1,24 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import miscUtil from '../../../utils/misc';
|
||||
|
||||
const {
|
||||
inject: { service }
|
||||
} = Ember;
|
||||
|
||||
export default Ember.Component.extend({
|
||||
link: service(),
|
||||
|
||||
isDirty: false,
|
||||
pageBody: "",
|
||||
|
||||
|
@ -45,6 +52,13 @@ export default Ember.Component.extend({
|
|||
},
|
||||
|
||||
actions: {
|
||||
onInsertLink(link) {
|
||||
let linkMarkdown = this.get('link').buildLink(link);
|
||||
miscUtil.insertAtCursor($("#section-markdown-editor")[0], linkMarkdown);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
isDirty() {
|
||||
return this.get('isDirty');
|
||||
},
|
||||
|
@ -62,4 +76,4 @@ export default Ember.Component.extend({
|
|||
this.attrs.onAction(page, meta);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,7 +16,7 @@ const {
|
|||
} = Ember;
|
||||
|
||||
export default Ember.Component.extend({
|
||||
appMeta: Ember.inject.service(),
|
||||
appMeta: service(),
|
||||
link: service(),
|
||||
pageBody: "",
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
|
@ -19,4 +19,13 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
this.audit.record("viewed-document");
|
||||
return this.get('documentService').getDocument(params.document_id);
|
||||
},
|
||||
});
|
||||
|
||||
actions: {
|
||||
error(error /*, transition*/ ) {
|
||||
if (error) {
|
||||
this.transitionTo('/not-found');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
|
@ -13,8 +13,7 @@ import Ember from 'ember';
|
|||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
|
||||
beforeModel: function () {
|
||||
beforeModel() {
|
||||
this.transitionTo('folders');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -101,5 +101,5 @@ export default Router.map(function () {
|
|||
path: '/*wildcard'
|
||||
});
|
||||
|
||||
this.route('pods', function () {});
|
||||
// this.route('pods', function () {});
|
||||
});
|
||||
|
|
|
@ -107,7 +107,7 @@ export default Ember.Service.extend({
|
|||
// handle section link
|
||||
if (link.linkType === "section") {
|
||||
let options = {};
|
||||
options['page'] = link.targetId;
|
||||
options['page'] = link.targetId;
|
||||
router.transitionTo('document', link.folderId, folderSlug, link.documentId, documentSlug, { queryParams: options });
|
||||
return;
|
||||
}
|
||||
|
@ -127,12 +127,5 @@ export default Ember.Service.extend({
|
|||
});
|
||||
|
||||
/*
|
||||
when attachment deleted:
|
||||
mark as orphan references where link.documentid = document.refId
|
||||
|
||||
permission checks:
|
||||
can view space
|
||||
can view document
|
||||
|
||||
Markdown editor support
|
||||
doc meta to show inbound and outbound links.
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
.edit-tools {
|
||||
margin: 0 0 0 20px;
|
||||
min-height: 600px;
|
||||
|
||||
> .toolbar {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
> .item {
|
||||
list-style-type: none;
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content-counter-dialog {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.content-linker-dialog {
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
<div class="edit-tools">
|
||||
|
||||
<div class="square-button-mono button-gray" id="content-linker-button" data-tooltip="Insert content link" data-tooltip-position="left middle">
|
||||
<i class="material-icons color-white">link</i>
|
||||
</div>
|
||||
<ul class="toolbar">
|
||||
<li class="item">
|
||||
<div class="square-button-mono button-gray" id="content-linker-button" data-tooltip="Reference link" data-tooltip-position="left middle">
|
||||
<i class="material-icons color-white">link</i>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{{#dropdown-dialog target="content-linker-button" position="bottom right" button="Insert" color="flat-blue" onAction=(action 'onInsertLink')}}
|
||||
<div class="content-linker-dialog">
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
{{#section/base-editor document=document folder=folder page=page isDirty=(action 'isDirty') onCancel=(action 'onCancel') onAction=(action 'onAction')}}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
{{focus-textarea id="section-markdown-editor" class="mousetrap bordered" value=pageBody}}
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="col-xs-5 col-sm-5 col-md-5 col-lg-5">
|
||||
<div id="section-markdown-preview" class="mousetrap bordered wysiwyg">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">
|
||||
{{document/edit-tools document=document folder=folder page=page onInsertLink=(action 'onInsertLink')}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/section/base-editor}}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
{{#section/base-editor document=document folder=folder page=page isDirty=(action 'isDirty') onCancel=(action 'onCancel') onAction=(action 'onAction')}}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-xs-11 col-sm-11 col-md-11 col-lg-11">
|
||||
{{focus-textarea value=pageBody id="rich-text-editor" class="mousetrap"}}
|
||||
</div>
|
||||
|
||||
<div class="pull-left width-96">
|
||||
{{focus-textarea value=pageBody id="rich-text-editor" class="mousetrap"}}
|
||||
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">
|
||||
{{document/edit-tools document=document folder=folder page=page onInsertLink=(action 'onInsertLink')}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pull-left">
|
||||
{{document/edit-tools document=document folder=folder page=page onInsertLink=(action 'onInsertLink')}}
|
||||
</div>
|
||||
|
||||
{{/section/base-editor}}
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
// from http://thecodeship.com/web-development/alternative-to-javascript-evil-setinterval/
|
||||
function interval(func, wait, times) {
|
||||
var interv = function(w, t) {
|
||||
return function() {
|
||||
if (typeof t === "undefined" || t-- > 0) {
|
||||
setTimeout(interv, w);
|
||||
try {
|
||||
func.call(null);
|
||||
} catch (e) {
|
||||
t = 0;
|
||||
throw e.toString();
|
||||
}
|
||||
}
|
||||
};
|
||||
}(wait, times);
|
||||
var interv = function (w, t) {
|
||||
return function () {
|
||||
if (typeof t === "undefined" || t-- > 0) {
|
||||
setTimeout(interv, w);
|
||||
try {
|
||||
func.call(null);
|
||||
} catch (e) {
|
||||
t = 0;
|
||||
throw e.toString();
|
||||
}
|
||||
}
|
||||
};
|
||||
}(wait, times);
|
||||
|
||||
setTimeout(interv, wait);
|
||||
setTimeout(interv, wait);
|
||||
}
|
||||
|
||||
// Function wrapping code.
|
||||
|
@ -35,12 +35,34 @@ function interval(func, wait, times) {
|
|||
// e.g. var fun1 = wrapFunction(sayStuff, this, ["Hello, world!"]);
|
||||
// http://stackoverflow.com/questions/899102/how-do-i-store-javascript-functions-in-a-queue-for-them-to-be-executed-eventuall
|
||||
function wrapFunction(fn, context, params) {
|
||||
return function() {
|
||||
fn.apply(context, params);
|
||||
};
|
||||
return function () {
|
||||
fn.apply(context, params);
|
||||
};
|
||||
}
|
||||
|
||||
function insertAtCursor(myField, myValue) {
|
||||
//IE support
|
||||
if (document.selection) {
|
||||
myField.focus();
|
||||
let sel = document.selection.createRange();
|
||||
sel.text = myValue;
|
||||
}
|
||||
//MOZILLA and others
|
||||
else if (myField.selectionStart || myField.selectionStart === '0') {
|
||||
var startPos = myField.selectionStart;
|
||||
var endPos = myField.selectionEnd;
|
||||
myField.value = myField.value.substring(0, startPos) +
|
||||
myValue +
|
||||
myField.value.substring(endPos, myField.value.length);
|
||||
myField.selectionStart = startPos + myValue.length;
|
||||
myField.selectionEnd = startPos + myValue.length;
|
||||
} else {
|
||||
myField.value += myValue;
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
interval,
|
||||
wrapFunction
|
||||
};
|
||||
interval,
|
||||
wrapFunction,
|
||||
insertAtCursor
|
||||
};
|
||||
|
|
|
@ -13,50 +13,50 @@
|
|||
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
||||
var isDevelopment = EmberApp.env() === 'development';
|
||||
|
||||
module.exports = function(defaults) {
|
||||
var app = new EmberApp(defaults, {
|
||||
fingerprint: {
|
||||
enabled: true,
|
||||
extensions: ['js', 'css'],
|
||||
exclude: ['tinymce/**', 'codemirror/**']
|
||||
},
|
||||
module.exports = function (defaults) {
|
||||
var app = new EmberApp(defaults, {
|
||||
fingerprint: {
|
||||
enabled: true,
|
||||
extensions: ['js', 'css'],
|
||||
exclude: ['tinymce/**', 'codemirror/**']
|
||||
},
|
||||
|
||||
minifyJS: {
|
||||
enabled: !isDevelopment,
|
||||
options: {
|
||||
exclude: ['tinymce/**', 'codemirror/**']
|
||||
}
|
||||
},
|
||||
minifyJS: {
|
||||
enabled: !isDevelopment,
|
||||
options: {
|
||||
exclude: ['tinymce/**', 'codemirror/**']
|
||||
}
|
||||
},
|
||||
|
||||
minifyCSS: {
|
||||
enabled: !isDevelopment,
|
||||
options: {
|
||||
exclude: ['tinymce/**', 'codemirror/**']
|
||||
}
|
||||
},
|
||||
minifyCSS: {
|
||||
enabled: !isDevelopment,
|
||||
options: {
|
||||
exclude: ['tinymce/**', 'codemirror/**']
|
||||
}
|
||||
},
|
||||
|
||||
sourcemaps: {
|
||||
enabled: isDevelopment,
|
||||
extensions: ['js']
|
||||
}
|
||||
});
|
||||
sourcemaps: {
|
||||
enabled: isDevelopment,
|
||||
extensions: ['js']
|
||||
}
|
||||
});
|
||||
|
||||
app.import('vendor/dropzone.js');
|
||||
app.import('vendor/is.js');
|
||||
app.import('vendor/md5.js');
|
||||
app.import('vendor/moment.js');
|
||||
app.import('vendor/mousetrap.js');
|
||||
app.import('vendor/table-editor.min.js');
|
||||
app.import('vendor/underscore.js');
|
||||
app.import('vendor/bootstrap.css');
|
||||
app.import('vendor/tether.js');
|
||||
app.import('vendor/drop.js');
|
||||
app.import('vendor/tooltip.js');
|
||||
app.import('vendor/markdown-it.min.js');
|
||||
app.import('vendor/dragula.js');
|
||||
app.import('vendor/dropzone.js');
|
||||
app.import('vendor/is.js');
|
||||
app.import('vendor/md5.js');
|
||||
app.import('vendor/moment.js');
|
||||
app.import('vendor/mousetrap.js');
|
||||
app.import('vendor/table-editor.min.js');
|
||||
app.import('vendor/underscore.js');
|
||||
app.import('vendor/bootstrap.css');
|
||||
app.import('vendor/tether.js');
|
||||
app.import('vendor/drop.js');
|
||||
app.import('vendor/tooltip.js');
|
||||
app.import('vendor/markdown-it.min.js');
|
||||
app.import('vendor/dragula.js');
|
||||
app.import('vendor/datetimepicker.min.js');
|
||||
app.import('vendor/hoverIntent.js');
|
||||
app.import('vendor/waypoints.js');
|
||||
|
||||
return app.toTree();
|
||||
return app.toTree();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue