This is 2.13 exercise in Erdmann and Wildon's book.
Define a center $$ Z(L) = \{ z\in L |\ [z,x]=0\ \forall \ x\in L \} $$
If $I$ is ideal of $L$ then let $$ B = C_L(I) = \{ z\in L|\ [z,x]=0\ \forall x\in I \} $$ (It is called by centralizer of $I$. So $B$ is ideal of $L$)
Consider the following conditions
(1) $Z(I)=0$
(2) If $D$ is a derivation on $I$ then $D = {\rm ad}_x$ for some $x\in I$
Then $$ L= I \oplus B$$
I have no skill or experience in Lie algebra. Thank you.