tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-12-20 06:07:53 +03:00
parent fee40ba47b
commit 3d8caaafb4

View File

@ -198,15 +198,11 @@ var plugin = {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// XXX PLUGIN_ATTRS // XXX PLUGIN_ATTRS
// XXX this needs to know in what context it is called -- view or code...
// .__pre_parse__(..) implements the view handler but we have no
// way yet to hook into code parsing...
// XXX need to call plugins from JSONOutline...
var attributes = { var attributes = {
__proto__: plugin, __proto__: plugin,
// XXX where should we get .__block_attrs__??? // XXX where should we get .__block_attrs__???
// ...editor, plugin, ...??? // ...editor (current), plugin, ...???
// XXX might be a good idea to split out the actual code handler to // XXX might be a good idea to split out the actual code handler to
// be overloadable by other plugins... // be overloadable by other plugins...
parseBlockAttrs: function(editor, text, keep=false, elem={}){ parseBlockAttrs: function(editor, text, keep=false, elem={}){
@ -245,7 +241,7 @@ var attributes = {
: clean : clean
return elem }, return elem },
__parse_block__: function(code, editor, elem){ __parse_code__: function(code, editor, elem){
return this.parseBlockAttrs( return this.parseBlockAttrs(
editor, editor,
code, code,
@ -1191,7 +1187,7 @@ var JSONOutline = {
// XXX PLUGIN_ATTRS... // XXX PLUGIN_ATTRS...
if(PLUGIN_ATTRS){ if(PLUGIN_ATTRS){
var attrs = {} var attrs = {}
attrs.text = that.threadPlugins('__parse_block__', block, that, attrs) attrs.text = that.threadPlugins('__parse_code__', block, that, attrs)
} else { } else {
var attrs = that.parseBlockAttrs(block) } var attrs = that.parseBlockAttrs(block) }
attrs.text = that.__text2code__(attrs.text attrs.text = that.__text2code__(attrs.text
@ -2734,8 +2730,8 @@ var Outline = {
if(PLUGIN_ATTRS){ if(PLUGIN_ATTRS){
elem.value = elem.value =
that.trim_block_text ? that.trim_block_text ?
that.threadPlugins('__parse_block__', elem.value, that).trim() that.threadPlugins('__parse_code__', elem.value, that).trim()
: that.threadPlugins('__parse_block__', elem.value, that) : that.threadPlugins('__parse_code__', elem.value, that)
} else { } else {
elem.value = elem.value =
that.trim_block_text ? that.trim_block_text ?