Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue where you can't add a link to an image with float set in Chrome #16

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,14 @@ function getAnchorListHTML(id, target) {

function insertAction() {
var inst = tinyMCEPopup.editor;
var elm, elementArray, i;
var olm, elm, elementArray, i;

elm = inst.selection.getNode();
olm = inst.selection.getNode();
floatVal = olm.style.cssFloat;
olm.style.cssFloat = null;
checkPrefix(document.forms[0].href);

elm = inst.dom.getParent(elm, "A");
elm = inst.dom.getParent(olm, "A");

// Remove element if there is no href
if (!document.forms[0].href.value) {
Expand Down Expand Up @@ -419,15 +421,17 @@ function insertAction() {
setAllAttribs(elm = elementArray[i]);
} else
setAllAttribs(elm);

// Don't move caret if selection was image
if (elm.childNodes.length != 1 || elm.firstChild.nodeName != 'IMG') {
inst.focus();
inst.selection.select(elm);
inst.selection.collapse(0);
tinyMCEPopup.storeSelection();
}

if(floatVal)
olm.style.cssFloat = floatVal;

tinyMCEPopup.execCommand("mceEndUndoLevel");
tinyMCEPopup.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,34 @@
require_once dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))))).'/config.core.php';
require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php';
require_once MODX_CONNECTORS_PATH.'index.php';

$list = array();
$ugroups = $modx->user->getUserGroupNames();
$ug = $modx->newQuery('modUserGroup');
$ug->where(array('name:IN'=>$ugroups));
$groupsin = $modx->getCollection('modUserGroup',$ug);
if(!empty($groupsin)){
foreach($groupsin as $gi){
$webContextAccess = $modx->newQuery('modAccessContext');
$webContextAccess->where(array(
'principal' =>$gi->get('id'),
'AND:target:!=' => 'mgr',
));
$gi_cntx = $modx->getCollection('modAccessContext', $webContextAccess);
if(!empty($gi_cntx)){
foreach($gi_cntx AS $acl){
if(!in_array($acl->get('target'), $list))
$list[] =$acl->get('target');
}
}
}
}
$searchMode = $modx->getOption('search-mode',$_REQUEST,'pagetitle');
$query = $modx->getOption('q',$_REQUEST,'');

$c = $modx->newQuery('modResource');
$c->where(array(
$searchMode.':LIKE' => '%'.$query.'%',
'context_key:IN' => $list,
));

$count = $modx->getCount('modResource',$c);
Expand All @@ -24,6 +45,6 @@
$resources = $modx->getCollection('modResource',$c);

foreach ($resources as $resource) {
echo $resource->get('pagetitle').' ('.$resource->get('id').')|'.$resource->get('id')."\n";
echo $resource->get('pagetitle').' ('.$resource->get('id').')|'.$resource->get('id')."\n";
}
die();