mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
Increase speed of TinyMce footer.
This commit is contained in:
parent
eaa44b075f
commit
c1f5a6f8dc
@ -3858,7 +3858,8 @@ class e107
|
||||
if(!isset($availEditors))
|
||||
{
|
||||
// init list of installed wysiwyg editors
|
||||
$availEditors = array_keys(e107::getPlug()->getInstalledWysiwygEditors());
|
||||
$availEditors = self::getPref('wysiwyg_list', array());
|
||||
// $availEditors = array_keys(e107::getPlug()->getInstalledWysiwygEditors()); // very slow.
|
||||
}
|
||||
|
||||
if(!is_null($val))
|
||||
@ -3873,7 +3874,8 @@ class e107
|
||||
// if no wysiwyg editor available, use fallback editor (bbcode)
|
||||
if(is_bool($editor) || ($editor !== $fallbackEditor && !in_array($editor, $availEditors)))
|
||||
{
|
||||
$editor = count($availEditors) > 0 ? $availEditors[0] : $fallbackEditor;
|
||||
$names = array_keys($availEditors);
|
||||
$editor = count($availEditors) > 0 ? reset($names) : $fallbackEditor;
|
||||
}
|
||||
}
|
||||
// $returnEditor => false:
|
||||
|
@ -1111,7 +1111,8 @@ class e_plugin
|
||||
$core->set('bbcode_list', array())
|
||||
->set('shortcode_legacy_list', array())
|
||||
->set('shortcode_list', array())
|
||||
->set('lan_global_list', array());
|
||||
->set('lan_global_list', array())
|
||||
->set('wysiwyg_list', array());
|
||||
|
||||
$paths = $this->getDetected();
|
||||
|
||||
@ -1240,6 +1241,8 @@ class e_plugin
|
||||
}
|
||||
}
|
||||
|
||||
$editors = $this->getInstalledWysiwygEditors();
|
||||
$core->setPref('wysiwyg_list',$editors);
|
||||
|
||||
$core->save(false, true, false);
|
||||
|
||||
|
@ -878,13 +878,16 @@ class e107Test extends \Codeception\Test\Unit
|
||||
$this->assertEquals($expected,$result);
|
||||
|
||||
}
|
||||
/*
|
||||
|
||||
public function testWysiwyg()
|
||||
{
|
||||
$res = null;
|
||||
$this->assertTrue($res);
|
||||
}
|
||||
$result = e107::wysiwyg(null, true);
|
||||
$expected = 'bbcode';
|
||||
|
||||
$this->assertSame($expected, $result);
|
||||
|
||||
}
|
||||
/*
|
||||
public function testLoadLanFiles()
|
||||
{
|
||||
$res = null;
|
||||
|
@ -30,7 +30,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetInstalledWysiwygEditors()
|
||||
{
|
||||
$expected = array('tinymce4'=>'TinyMce4');
|
||||
$result = $this->ep->getInstalledWysiwygEditors();
|
||||
|
||||
$this->assertSame($expected,$result);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Creates a dummy plugin entry to make sure such plugins are ignored
|
||||
*/
|
||||
@ -99,21 +107,25 @@
|
||||
$newUrls = array('gallery'=>0, 'news'=>'news', 'rss_menu'=>0);
|
||||
|
||||
e107::getConfig()->setData('e_url_list', $newUrls)->save(false,false,false);
|
||||
e107::getConfig()->setData('wysiwyg_list', array())->save(false,false,false);
|
||||
|
||||
$urlsBefore = e107::pref('core', 'e_url_list');
|
||||
$userBefore = e107::pref('core', 'e_user_list');
|
||||
$wysiwygBefore = e107::pref('core', 'wysiwyg_list',array());
|
||||
|
||||
// print_r($userBefore);
|
||||
// print_r($wysiwygBefore);
|
||||
|
||||
$this->ep->clearCache()->buildAddonPrefLists();
|
||||
|
||||
$urlsAfter = e107::pref('core', 'e_url_list');
|
||||
$userAfter = e107::pref('core', 'e_user_list');
|
||||
$wysiwygAfter = e107::pref('core', 'wysiwyg_list');
|
||||
|
||||
// print_r($userAfter);
|
||||
// print_r($wysiwygAfter);
|
||||
|
||||
$this->assertEquals($urlsBefore['gallery'],$urlsAfter['gallery']);
|
||||
$this->assertEquals($userBefore['user'],$userAfter['user']);
|
||||
$this->assertNotSame($wysiwygBefore,$wysiwygAfter);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user