CCM NG:
- Put all files for ccm-editor into one Maven module to avoid problems with TypeScript module resolution - Internal Links Command for ccm-editor git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5209 8810af33-2d31-482b-a856-94f89814c4df
parent
0929e727e0
commit
1993ec5b16
|
|
@ -69,11 +69,6 @@
|
|||
<artifactId>ccm-editor</artifactId>
|
||||
<type>jar</type>
|
||||
</overlay>
|
||||
<overlay>
|
||||
<groupId>org.librecms</groupId>
|
||||
<artifactId>ccm-cms-editor</artifactId>
|
||||
<type>jar</type>
|
||||
</overlay>
|
||||
<overlay>
|
||||
<groupId>org.libreccm</groupId>
|
||||
<artifactId>ccm-theme-foundry</artifactId>
|
||||
|
|
|
|||
|
|
@ -53,11 +53,6 @@
|
|||
<artifactId>ccm-cms</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.librecms</groupId>
|
||||
<artifactId>ccm-cms-editor</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<!-- CCM Modules end -->
|
||||
|
||||
<!-- Dependencies for log4j 2 including adapter for the log4j 1.2 API -->
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
module.exports = function(grunt) {
|
||||
grunt.initConfig({
|
||||
ts: {
|
||||
default : {
|
||||
options: {
|
||||
module: "amd",
|
||||
tsconfig: true,
|
||||
moduleResolution: "classic"
|
||||
}
|
||||
}
|
||||
},
|
||||
clean: ['scripts/*.js', 'scripts/*.js.map', 'scripts/.tscache']
|
||||
});
|
||||
grunt.loadNpmTasks("grunt-ts");
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.registerTask("default", ["ts"]);
|
||||
};
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"name": "ccm-cms-editor",
|
||||
"version": "7.0.0",
|
||||
"description": "CMS modules for the ccm-editor",
|
||||
"repository": {
|
||||
"type": "svn",
|
||||
"url": "https://svn.libreccm.org/ccm/ccm_ng/ccm-cms-editor"
|
||||
},
|
||||
"author": "Jens Pelzetter",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"font-awesome": "^4.7.0",
|
||||
"requirejs": "^2.3.5",
|
||||
"requirejs-domready": "^2.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "^1.0.1",
|
||||
"grunt-cli": "^1.2.0",
|
||||
"grunt-contrib-clean": "^1.1.0",
|
||||
"grunt-ts": "^6.0.0-beta.17",
|
||||
"typescript": "^2.6.2"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<timestamp>${maven.build.timestamp}</timestamp>
|
||||
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'Z</maven.build.timestamp.format>
|
||||
</properties>
|
||||
|
||||
<parent>
|
||||
<groupId>org.libreccm</groupId>
|
||||
<artifactId>libreccm-parent</artifactId>
|
||||
<version>7.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.librecms</groupId>
|
||||
<artifactId>ccm-cms-editor</artifactId>
|
||||
<version>7.0.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>LibreCMS modules for the ccm-editor</name>
|
||||
<description>
|
||||
Provides CMS specific modules for the ccm-editor.
|
||||
</description>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Lesser GPL 2.1</name>
|
||||
<url>http://www.gnu.org/licenses/old-licenses/lgpl-2.1</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.libreccm</groupId>
|
||||
<artifactId>ccm-editor</artifactId>
|
||||
<version>7.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>ccm-editor</finalName>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/typescript</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.github.eirslett</groupId>
|
||||
<artifactId>frontend-maven-plugin</artifactId>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
<id>Install node.js and NPM</id>
|
||||
<goals>
|
||||
<goal>install-node-and-npm</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<nodeVersion>v6.12.3</nodeVersion>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm install</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>grunt build</id>
|
||||
<goals>
|
||||
<goal>grunt</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
CCM Editor modules for LibreCMS
|
||||
---
|
||||
|
||||
This module provides two new commands for the CCM Editor which are only useful
|
||||
in combination with the LibreCMS module:
|
||||
|
||||
* Insert Internal Link: Adds an internal link to a content item
|
||||
* Insert Image: Inserts a image from the media library of LibreCMS
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project xmlns="http://maven.apache.org/DECORATION/1.3.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0
|
||||
http://maven.apache.org/xsd/decoration-1.3.0.xsd">
|
||||
|
||||
<body>
|
||||
<menu name="Parent project">
|
||||
<item name="LibreCCM" href="../index.html"/>
|
||||
</menu>
|
||||
|
||||
<menu name="Overview">
|
||||
<item name="CCM Editor modules for LibreCMS" href="index.html"/>
|
||||
</menu>
|
||||
|
||||
<menu ref="reports"/>
|
||||
</body>
|
||||
</project>
|
||||
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"include": [
|
||||
"./src/main/typescript/**/*"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"rootDirs": [
|
||||
"../ccm-editor/src/main/typescript/ccm-editor",
|
||||
"./src/main/typescript/ccm-editor"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ public class Assets {
|
|||
|
||||
@GET
|
||||
@Path("/")
|
||||
@Produces("text/json; charset=utf-8")
|
||||
@Produces("application/json; charset=utf-8")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<Map<String, String>> findAssets(
|
||||
@PathParam("content-section") final String section,
|
||||
|
|
@ -194,7 +194,7 @@ public class Assets {
|
|||
|
||||
@GET
|
||||
@Path("/folders/")
|
||||
@Produces("text/json; charset=utf-8")
|
||||
@Produces("application/json; charset=utf-8")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<Map<String, String>> findAssetsInRootFolder(
|
||||
@PathParam("content-section") final String section,
|
||||
|
|
@ -213,7 +213,7 @@ public class Assets {
|
|||
|
||||
@GET
|
||||
@Path("/folders/{folder}/")
|
||||
@Produces("text/json; charset=utf-8")
|
||||
@Produces("application/json; charset=utf-8")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<Map<String, String>> findAssetsInFolder(
|
||||
@PathParam("content-section") final String section,
|
||||
|
|
|
|||
|
|
@ -128,6 +128,8 @@ public class ContentItems {
|
|||
result.put("itemId",
|
||||
Long.toString(item.getObjectId()));
|
||||
|
||||
result.put("name", item.getDisplayName());
|
||||
|
||||
result.put("title",
|
||||
item.getTitle().getValue(globalizationHelper
|
||||
.getNegotiatedLocale()));
|
||||
|
|
@ -155,7 +157,7 @@ public class ContentItems {
|
|||
|
||||
@GET
|
||||
@Path("/")
|
||||
@Produces("text/json; charset=utf-8")
|
||||
@Produces("application/json; charset=utf-8")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<Map<String, String>> findItems(
|
||||
@PathParam("content-section") final String section,
|
||||
|
|
@ -202,7 +204,7 @@ public class ContentItems {
|
|||
|
||||
@GET
|
||||
@Path("/folders")
|
||||
@Produces("text/json; charset=utf-8")
|
||||
@Produces("application/json; charset=utf-8")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<Map<String, String>> findItemsInRootFolder(
|
||||
@PathParam("content-section") final String section,
|
||||
|
|
@ -221,7 +223,7 @@ public class ContentItems {
|
|||
|
||||
@GET
|
||||
@Path("/folders/{folder}/")
|
||||
@Produces("text/json; charset=utf-8")
|
||||
@Produces("application/json; charset=utf-8")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<Map<String, String>> findItemsInFolder(
|
||||
@PathParam("content-section") final String section,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class ContentSections {
|
|||
|
||||
@GET
|
||||
@Path("/")
|
||||
@Produces("text/json; charset=utf-8")
|
||||
@Produces("application/json; charset=utf-8")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<Map<String, String>> listContentSections() {
|
||||
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ public class PagesRouter {
|
|||
|
||||
@GET
|
||||
@Path("/{name:[\\w\\-]+}.{lang:\\w+}.json")
|
||||
@Produces("text/json")
|
||||
@Produces("application/json")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getRootPageAsJson(
|
||||
@Context
|
||||
|
|
@ -433,7 +433,7 @@ public class PagesRouter {
|
|||
*/
|
||||
@GET
|
||||
@Path("/{page:[\\w/]+}/{name:[\\w\\-]+}.{lang:\\w+}.json")
|
||||
@Produces("text/json")
|
||||
@Produces("application/json")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getPageAsJson(
|
||||
@Context
|
||||
|
|
|
|||
|
|
@ -2,16 +2,14 @@ module.exports = function(grunt) {
|
|||
grunt.initConfig({
|
||||
ts: {
|
||||
default : {
|
||||
src: ["src/main/typescript/**/*.ts"],
|
||||
tsconfig: true,
|
||||
options: {
|
||||
module: "amd"
|
||||
module: "amd",
|
||||
moduleResolution: "classic"
|
||||
}
|
||||
}
|
||||
},
|
||||
clean: ['scripts/*.js', 'scripts/*.js.map', 'scripts/.tscache']
|
||||
});
|
||||
grunt.loadNpmTasks("grunt-ts");
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.registerTask("default", ["ts"]);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -82,25 +82,34 @@
|
|||
padding: 1em 0.75em;
|
||||
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
|
||||
margin-top: -35em;
|
||||
margin-left: -20em;
|
||||
margin-top: -20em;
|
||||
margin-left: -35em;
|
||||
|
||||
width: 70em;
|
||||
height: 40em;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.ccm-editor-selectdialog h1 {
|
||||
padding: 0.5em;
|
||||
margin-bottom: 0.8em;
|
||||
}
|
||||
|
||||
.ccm-editor-selectdialog .ccm-editor-selectdialog-closebutton {
|
||||
|
||||
postion: absolute;
|
||||
font-size: 1em;
|
||||
|
||||
padding: 0.25em;
|
||||
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
width: 2.5em;
|
||||
height: 2.5em;
|
||||
}
|
||||
|
||||
.ccm-editor-selectdialog div {
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ export class InsertInternalLinkCommand extends CCMEditorCommand {
|
|||
|
||||
const closeButton = dialogElem
|
||||
.appendChild(document.createElement("button"));
|
||||
closeButton.setAttribute("id", "ccm-editor-selectdialog-closebutton");
|
||||
closeButton.textContent = "✕";
|
||||
closeButton.setAttribute("class", "ccm-editor-selectdialog-closebutton");
|
||||
closeButton.textContent = "\u2715";
|
||||
closeButton.addEventListener("click", function(event){
|
||||
event.preventDefault();
|
||||
const bodyElem = document.getElementsByTagName("body").item(0);
|
||||
|
|
@ -127,12 +127,22 @@ export class InsertInternalLinkCommand extends CCMEditorCommand {
|
|||
}
|
||||
}
|
||||
});
|
||||
sectionsRequest.send();
|
||||
|
||||
console.log("Current sections is \"" + currentSection + "\"");
|
||||
// Get items
|
||||
let itemsUrl = contextPrefix
|
||||
+ "/content-sections/"
|
||||
+ contentSectionSelect.value
|
||||
+ "/items";
|
||||
+ "/content-sections";
|
||||
if (!(new RegExp("^/.*").test(currentSection))) {
|
||||
console.log("Current sections does not start with an \"/\", adding one...");
|
||||
itemsUrl += "/";
|
||||
}
|
||||
itemsUrl += currentSection;
|
||||
if (!(new RegExp(".*/$").test(currentSection))) {
|
||||
console.log("Current sections does not end with an \"/\", adding one...");
|
||||
itemsUrl += "/";
|
||||
}
|
||||
itemsUrl += "items";
|
||||
if (filterInput.value !== null && filterInput.value.length > 0) {
|
||||
itemsUrl + "?query=" + filterInput.value;
|
||||
}
|
||||
|
|
@ -156,17 +166,25 @@ export class InsertInternalLinkCommand extends CCMEditorCommand {
|
|||
|
||||
const selectItemButton = dataTitle
|
||||
.appendChild(document.createElement("button"));
|
||||
if (item["title"] === null
|
||||
|| item["title"].length <= 0) {
|
||||
selectItemButton.textContent = item["name"];
|
||||
} else {
|
||||
selectItemButton.textContent = item["title"];
|
||||
}
|
||||
selectItemButton
|
||||
.addEventListener("click", function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
document.removeChild(dialogElem);
|
||||
const bodyElem = document
|
||||
.getElementsByTagName("body")
|
||||
.item(0);
|
||||
bodyElem.removeChild(dialogElem);
|
||||
document.getSelection().removeAllRanges();
|
||||
document.getSelection().addRange(currentRange);
|
||||
|
||||
document.execCommand("insertLink",
|
||||
document.execCommand("createLink",
|
||||
false,
|
||||
contextPrefix
|
||||
+ "/redirect/?oid="
|
||||
|
|
@ -180,6 +198,7 @@ export class InsertInternalLinkCommand extends CCMEditorCommand {
|
|||
}
|
||||
}
|
||||
});
|
||||
itemsRequest.send();
|
||||
|
||||
const bodyElem = document.getElementsByTagName("body").item(0);
|
||||
bodyElem.appendChild(dialogFragment);
|
||||
|
|
@ -387,28 +387,28 @@ export class FormatBlockCommand extends CCMEditorCommand {
|
|||
private findBlockElement(node: Node): Element {
|
||||
|
||||
if (node instanceof Element) {
|
||||
console.log("Current node is an element.");
|
||||
// console.log("Current node is an element.");
|
||||
const elem: Element = node as Element;
|
||||
console.log("elem.tagName = " + elem.tagName.toLowerCase());
|
||||
// console.log("elem.tagName = " + elem.tagName.toLowerCase());
|
||||
if(this.values.indexOf(elem.tagName.toLowerCase()) === -1) {
|
||||
console.log("elem.tagName is not in the values array.");
|
||||
// console.log("elem.tagName is not in the values array.");
|
||||
if (elem.parentNode === null) {
|
||||
console.log("elem has no parent node. Returning null.");
|
||||
// console.log("elem has no parent node. Returning null.");
|
||||
return null;
|
||||
} else {
|
||||
console.log("Continuing with elem.parentNode");
|
||||
// console.log("Continuing with elem.parentNode");
|
||||
return this.findBlockElement(elem.parentNode);
|
||||
}
|
||||
} else {
|
||||
return elem;
|
||||
}
|
||||
} else {
|
||||
console.log("Current node is not an element node.");
|
||||
// console.log("Current node is not an element node.");
|
||||
if (node.parentNode === null) {
|
||||
console.log("Current node has no parent, returning null.");
|
||||
// console.log("Current node has no parent, returning null.");
|
||||
return null;
|
||||
} else {
|
||||
console.log("Continuing with parent node...");
|
||||
// console.log("Continuing with parent node...");
|
||||
return this.findBlockElement(node.parentNode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue