Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
643 views
in Q2A Core by

I wanted to write my own custom Editor with its viewer modul. So I put both Editor and Viewer php classes in the qa-plugin/my-editor directory. The qa-plugin.php file loads both the editor and the view as follows:

qa_register_plugin_module('editor', 'my-editor.php', 'my_editor', 'My Editor');
qa_register_plugin_module('viewer', 'my-viewer.php', 'my_viewer', 'My Viewer');

 

In the Admin->posting Console, I selected 'My Editor'. But it seems that the basic view is always selected. In the editor the data are saved in a Format 'MYFORMAT' and it is calculated that when 'MYFORMAT' it should return 1.0. But the basic view is always used.

How can I force Q2A to choose my view?

by
Hi there. Can you post the code of your classes somewhere (even here?) so I can take a look. You can remove anything proprietary.
by
edited by
Now it works but only with a trick. I took the Q2A basic viewer and changed only get_html and calc_quality methods. First my calc_quality looked like this
function calc_quality($content, $format)
        {           
            if ( ($format=='') || ($format=='MYFORMAT'))
                return 1.0;
            else
                return 0;
        }

But the Q2A always used the basic viewer. So instead of returning 1.0 the method now returns 1.1. In this case Q2A started to use my viewer.
by
Glad you fixed it. BTW unless you want to modify how plain text is displayed, you should only return 1.0 for 'MYFORMAT', not for ''.
by
Thanks! We were just implementing a BBCode Editor and had the same problem. Now with the 1.1 trick it worked :-)

Please log in or register to answer this question.

...