1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.wysiwyg.server

File WysiwygEditorScriptService.java

 

Code metrics

0
0
0
1
86
15
0
-
-
0
-

Classes

Class Line # Actions
WysiwygEditorScriptService 33 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.wysiwyg.server;
21   
22    import org.xwiki.component.annotation.Role;
23    import org.xwiki.model.reference.DocumentReference;
24    import org.xwiki.script.service.ScriptService;
25    import org.xwiki.stability.Unstable;
26   
27    /**
28    * The WYSIWYG editor API exposed to server-side scripts like Velocity.
29    *
30    * @version $Id: fddfc88662fef57cf2ebfab1e8a1c9117401f786 $
31    */
32    @Role
 
33    public interface WysiwygEditorScriptService extends ScriptService
34    {
35    /**
36    * Checks if there is a parser and a renderer available for the specified syntax.
37    * <p>
38    * This method should be called before attempting to load the WYSIWYG editor.
39    *
40    * @param syntaxId the syntax identifier, like {@code xwiki/2.0}
41    * @return {@code true} if the specified syntax is currently supported by the editor, {@code false} otherwise
42    */
43    boolean isSyntaxSupported(String syntaxId);
44   
45    /**
46    * Parses the given HTML fragment and renders the result in annotated XHTML syntax.
47    * <p>
48    * This method is currently used in {@code wysiwyginput.vm} and its purpose is to refresh the content of the WYSIWYG
49    * editor. This method is called for instance when a macro is inserted or edited.
50    *
51    * @param html the HTML fragment to be rendered
52    * @param syntaxId the storage syntax identifier
53    * @return the XHTML result of rendering the given HTML fragment
54    */
55    String parseAndRender(String html, String syntaxId);
56   
57    /**
58    * Produces the input for the editor by rendering the specified content template as a full HTML page, making sure
59    * the skin extension hooks are resolved. The template is rendered in the context of the current document and the
60    * Velocity context is not isolated so you can put the data needed by the template in the Velocity context before
61    * calling this method. The advantage of using this method to obtain the editor input is that the editor doesn't
62    * have to make an additional HTTP request for the content template.
63    *
64    * @param templateReference specifies the document that serves as the template for the editor content
65    * @return the result of rendering the specified content template
66    * @since 7.4.1
67    * @since 8.0M1
68    */
69    @Unstable
70    String render(DocumentReference templateReference);
71   
72    /**
73    * Converts the given source text from the specified syntax to annotated XHTML, which can be used as input for the
74    * WYSIWYG editor.
75    *
76    * @param source the text to be converted
77    * @param syntaxId the syntax identifier
78    * @return the annotated XHTML result of the conversion
79    */
80    String toAnnotatedXHTML(String source, String syntaxId);
81   
82    /**
83    * @return the WYSIWYG editor configuration object
84    */
85    WysiwygEditorConfiguration getConfig();
86    }